Spaces:
Running
on
Zero
Running
on
Zero
v2p2
Browse files
app.py
CHANGED
@@ -403,4 +403,51 @@ with gr.Blocks(css="style.css") as demo:
|
|
403 |
inputs=inputs,
|
404 |
outputs=[result, gr_metadata, history_dropdown],
|
405 |
api_name=False,
|
406 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
inputs=inputs,
|
404 |
outputs=[result, gr_metadata, history_dropdown],
|
405 |
api_name=False,
|
406 |
+
)
|
407 |
+
run_button.click(
|
408 |
+
fn=utils.randomize_seed_fn,
|
409 |
+
inputs=[seed, randomize_seed],
|
410 |
+
outputs=seed,
|
411 |
+
queue=False,
|
412 |
+
api_name=False,
|
413 |
+
).then(
|
414 |
+
fn=generate,
|
415 |
+
inputs=inputs,
|
416 |
+
outputs=[result, gr_metadata, history_dropdown],
|
417 |
+
api_name=False,
|
418 |
+
)
|
419 |
+
|
420 |
+
apply_json_button.click(
|
421 |
+
fn=apply_json_parameters,
|
422 |
+
inputs=json_input,
|
423 |
+
outputs=[prompt, negative_prompt, seed, custom_width, custom_height,
|
424 |
+
guidance_scale, num_inference_steps, sampler,
|
425 |
+
aspect_ratio_selector, use_upscaler, upscaler_strength, upscale_by]
|
426 |
+
)
|
427 |
+
|
428 |
+
clear_button.click(
|
429 |
+
fn=lambda: (gr.update(value=""), gr.update(value=""), gr.update(value=0),
|
430 |
+
gr.update(value=1024), gr.update(value=1024),
|
431 |
+
gr.update(value=7.0), gr.update(value=30),
|
432 |
+
gr.update(value="DPM++ 2M SDE Karras"),
|
433 |
+
gr.update(value="1024 x 1024"), gr.update(value=False),
|
434 |
+
gr.update(value=0.55), gr.update(value=1.5)),
|
435 |
+
inputs=[],
|
436 |
+
outputs=[prompt, negative_prompt, seed, custom_width, custom_height,
|
437 |
+
guidance_scale, num_inference_steps, sampler,
|
438 |
+
aspect_ratio_selector, use_upscaler, upscaler_strength, upscale_by]
|
439 |
+
)
|
440 |
+
|
441 |
+
random_prompt_button.click(
|
442 |
+
fn=get_random_prompt,
|
443 |
+
inputs=[],
|
444 |
+
outputs=prompt
|
445 |
+
)
|
446 |
+
|
447 |
+
history_dropdown.change(
|
448 |
+
fn=lambda x: gr.update(value=x),
|
449 |
+
inputs=history_dropdown,
|
450 |
+
outputs=prompt
|
451 |
+
)
|
452 |
+
|
453 |
+
demo.queue(max_size=20).launch(debug=IS_COLAB, share=IS_COLAB)
|