Miquel Farré
commited on
Commit
·
c228837
1
Parent(s):
701026e
avoid bsod in second run because of result from execution -1 identified
Browse files
app.py
CHANGED
|
@@ -463,8 +463,9 @@ with gr.Blocks(css=custom_css, js=custom_js) as demo:
|
|
| 463 |
update_btn = gr.Button("Let's go!")
|
| 464 |
|
| 465 |
# Function to set view-only mode
|
| 466 |
-
def
|
| 467 |
-
|
|
|
|
| 468 |
|
| 469 |
# Function to set interactive mode
|
| 470 |
def set_interactive_mode(request: gr.Request):
|
|
@@ -484,9 +485,9 @@ with gr.Blocks(css=custom_css, js=custom_js) as demo:
|
|
| 484 |
# Chain the events
|
| 485 |
# 1. Set view-only mode when button is clicked
|
| 486 |
view_only_event = update_btn.click(
|
| 487 |
-
fn=
|
| 488 |
inputs=[task_input],
|
| 489 |
-
outputs=html_output
|
| 490 |
)
|
| 491 |
|
| 492 |
# 2. Then run the agent task
|
|
|
|
| 463 |
update_btn = gr.Button("Let's go!")
|
| 464 |
|
| 465 |
# Function to set view-only mode
|
| 466 |
+
def clear_and_set_view_only(task_input, request: gr.Request):
|
| 467 |
+
# First clear the results, then set view-only mode
|
| 468 |
+
return "", update_html(False, request)
|
| 469 |
|
| 470 |
# Function to set interactive mode
|
| 471 |
def set_interactive_mode(request: gr.Request):
|
|
|
|
| 485 |
# Chain the events
|
| 486 |
# 1. Set view-only mode when button is clicked
|
| 487 |
view_only_event = update_btn.click(
|
| 488 |
+
fn=clear_and_set_view_only,
|
| 489 |
inputs=[task_input],
|
| 490 |
+
outputs=[results_output, html_output]
|
| 491 |
)
|
| 492 |
|
| 493 |
# 2. Then run the agent task
|