Spaces:
Running
on
Zero
Running
on
Zero
Update
Browse files
app.py
CHANGED
@@ -74,38 +74,27 @@ def create_demo(mode_name: str) -> gr.Blocks:
|
|
74 |
with gr.Column():
|
75 |
result_image = gr.Image(label="Generated image", visible=mode_name in ["t2i", "i", "joint", "i2t2i"])
|
76 |
result_text = gr.Text(label="Generated text", visible=mode_name in ["i2t", "t", "joint", "t2i2t"])
|
77 |
-
|
78 |
-
|
79 |
-
prompt,
|
80 |
-
image,
|
81 |
-
seed,
|
82 |
-
num_steps,
|
83 |
-
guidance_scale,
|
84 |
-
]
|
85 |
-
outputs = [
|
86 |
-
result_image,
|
87 |
-
result_text,
|
88 |
-
]
|
89 |
-
|
90 |
-
prompt.submit(
|
91 |
-
fn=randomize_seed_fn,
|
92 |
-
inputs=[seed, randomize_seed],
|
93 |
-
outputs=seed,
|
94 |
-
queue=False,
|
95 |
-
).then(
|
96 |
-
fn=model.run,
|
97 |
-
inputs=inputs,
|
98 |
-
outputs=outputs,
|
99 |
-
)
|
100 |
-
run_button.click(
|
101 |
fn=randomize_seed_fn,
|
102 |
inputs=[seed, randomize_seed],
|
103 |
outputs=seed,
|
104 |
queue=False,
|
105 |
).then(
|
106 |
fn=model.run,
|
107 |
-
inputs=
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
api_name=f"run_{mode_name}",
|
110 |
)
|
111 |
return demo
|
|
|
74 |
with gr.Column():
|
75 |
result_image = gr.Image(label="Generated image", visible=mode_name in ["t2i", "i", "joint", "i2t2i"])
|
76 |
result_text = gr.Text(label="Generated text", visible=mode_name in ["i2t", "t", "joint", "t2i2t"])
|
77 |
+
|
78 |
+
gr.on(
|
79 |
+
triggers=[prompt.submit, run_button.click],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
fn=randomize_seed_fn,
|
81 |
inputs=[seed, randomize_seed],
|
82 |
outputs=seed,
|
83 |
queue=False,
|
84 |
).then(
|
85 |
fn=model.run,
|
86 |
+
inputs=[
|
87 |
+
mode,
|
88 |
+
prompt,
|
89 |
+
image,
|
90 |
+
seed,
|
91 |
+
num_steps,
|
92 |
+
guidance_scale,
|
93 |
+
],
|
94 |
+
outputs=[
|
95 |
+
result_image,
|
96 |
+
result_text,
|
97 |
+
],
|
98 |
api_name=f"run_{mode_name}",
|
99 |
)
|
100 |
return demo
|