Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -415,8 +415,9 @@ def create_demo():
|
|
| 415 |
custom_prompt = gr.Textbox(label="Prompt", lines=4, value="")
|
| 416 |
with gr.Accordion("Mistral API Key (optional)", open=False):
|
| 417 |
api_key = gr.Textbox(label="API Key", type="password", max_lines=1)
|
| 418 |
-
|
| 419 |
-
|
|
|
|
| 420 |
output_md = gr.Markdown("")
|
| 421 |
status_state = gr.State("idle")
|
| 422 |
|
|
@@ -451,6 +452,7 @@ def create_demo():
|
|
| 451 |
try:
|
| 452 |
if not url: raise ValueError("No URL provided.")
|
| 453 |
src = url
|
|
|
|
| 454 |
result = run_blocking_in_thread(process_media, src, prompt or "", key or "", progress)
|
| 455 |
|
| 456 |
if hasattr(result, "result"): result = result.result()
|
|
@@ -464,9 +466,7 @@ def create_demo():
|
|
| 464 |
outputs=[status_state, output_md],
|
| 465 |
)
|
| 466 |
|
| 467 |
-
|
| 468 |
-
return _btn_label_for_status(s)
|
| 469 |
-
status_state.change(fn=btn_label_for_state, inputs=[status_state], outputs=[submit_btn])
|
| 470 |
|
| 471 |
return demo
|
| 472 |
|
|
|
|
| 415 |
custom_prompt = gr.Textbox(label="Prompt", lines=4, value="")
|
| 416 |
with gr.Accordion("Mistral API Key (optional)", open=False):
|
| 417 |
api_key = gr.Textbox(label="API Key", type="password", max_lines=1)
|
| 418 |
+
with gr.Row(): # Buttons in the same row
|
| 419 |
+
submit_btn = gr.Button("Submit")
|
| 420 |
+
clear_btn = gr.Button("Clear")
|
| 421 |
output_md = gr.Markdown("")
|
| 422 |
status_state = gr.State("idle")
|
| 423 |
|
|
|
|
| 452 |
try:
|
| 453 |
if not url: raise ValueError("No URL provided.")
|
| 454 |
src = url
|
| 455 |
+
progress(0, desc="Starting processing...")
|
| 456 |
result = run_blocking_in_thread(process_media, src, prompt or "", key or "", progress)
|
| 457 |
|
| 458 |
if hasattr(result, "result"): result = result.result()
|
|
|
|
| 466 |
outputs=[status_state, output_md],
|
| 467 |
)
|
| 468 |
|
| 469 |
+
status_state.change(fn=lambda s: _btn_label_for_status(s), inputs=[status_state], outputs=[submit_btn])
|
|
|
|
|
|
|
| 470 |
|
| 471 |
return demo
|
| 472 |
|