Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -228,6 +228,12 @@ with gr.Blocks(css=css) as demo:
|
|
| 228 |
placeholder="describe the edit instruction",
|
| 229 |
container=False,
|
| 230 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
run_button = gr.Button("Edit!", variant="primary")
|
| 232 |
|
| 233 |
result = gr.Image(label="Result", show_label=False, type="pil")
|
|
@@ -272,10 +278,17 @@ with gr.Blocks(css=css) as demo:
|
|
| 272 |
|
| 273 |
gr.on(
|
| 274 |
triggers=[run_button.click, prompt.submit],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 275 |
fn=infer,
|
| 276 |
inputs=[
|
| 277 |
input_image,
|
| 278 |
-
|
| 279 |
# negative_prompt is no longer an input from the UI
|
| 280 |
seed,
|
| 281 |
randomize_seed,
|
|
@@ -287,4 +300,4 @@ with gr.Blocks(css=css) as demo:
|
|
| 287 |
)
|
| 288 |
|
| 289 |
if __name__ == "__main__":
|
| 290 |
-
demo.launch()
|
|
|
|
| 228 |
placeholder="describe the edit instruction",
|
| 229 |
container=False,
|
| 230 |
)
|
| 231 |
+
rewriten_prompt = gr.Text(
|
| 232 |
+
label="Rewritten prompt",
|
| 233 |
+
show_label=False,
|
| 234 |
+
placeholder="Rewritten prompt",
|
| 235 |
+
container=False,
|
| 236 |
+
)
|
| 237 |
run_button = gr.Button("Edit!", variant="primary")
|
| 238 |
|
| 239 |
result = gr.Image(label="Result", show_label=False, type="pil")
|
|
|
|
| 278 |
|
| 279 |
gr.on(
|
| 280 |
triggers=[run_button.click, prompt.submit],
|
| 281 |
+
fn=polish_prompt,
|
| 282 |
+
inputs=[
|
| 283 |
+
prompt,
|
| 284 |
+
input_image,
|
| 285 |
+
],
|
| 286 |
+
outputs=[rewriten_prompt],
|
| 287 |
+
).then(
|
| 288 |
fn=infer,
|
| 289 |
inputs=[
|
| 290 |
input_image,
|
| 291 |
+
rewriten_prompt,
|
| 292 |
# negative_prompt is no longer an input from the UI
|
| 293 |
seed,
|
| 294 |
randomize_seed,
|
|
|
|
| 300 |
)
|
| 301 |
|
| 302 |
if __name__ == "__main__":
|
| 303 |
+
demo.launch()
|