Spaces:
Sleeping
Sleeping
Implemented skipping
Browse files
app.py
CHANGED
|
@@ -447,12 +447,14 @@ if __name__ == "__main__":
|
|
| 447 |
outputs=actual_output,
|
| 448 |
)
|
| 449 |
|
| 450 |
-
|
|
|
|
|
|
|
| 451 |
|
| 452 |
submit_button.click(
|
| 453 |
# on submit, show the upload status UI and hide the main UI and submit button
|
| 454 |
fn=lambda: (gr.update(visible=True), gr.update(visible=False), gr.update(visible=False)),
|
| 455 |
-
outputs=[upload_ui, form_ui,
|
| 456 |
).then(
|
| 457 |
# then handle the submission
|
| 458 |
fn=handle_submission,
|
|
@@ -498,7 +500,41 @@ if __name__ == "__main__":
|
|
| 498 |
).then(
|
| 499 |
# then hide the upload UI and show the main UI and submit button again
|
| 500 |
fn=lambda: (gr.update(visible=False), gr.update(visible=True), gr.update(visible=True)),
|
| 501 |
-
outputs=[upload_ui, form_ui,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 502 |
)
|
| 503 |
|
| 504 |
demo.load(load_user, None, outputs=[username, user_scenarios]).then(
|
|
|
|
| 447 |
outputs=actual_output,
|
| 448 |
)
|
| 449 |
|
| 450 |
+
with gr.Row() as button_row:
|
| 451 |
+
skip_button = gr.Button("Skip Scenario", variant="secondary")
|
| 452 |
+
submit_button = gr.Button("Submit", variant="primary")
|
| 453 |
|
| 454 |
submit_button.click(
|
| 455 |
# on submit, show the upload status UI and hide the main UI and submit button
|
| 456 |
fn=lambda: (gr.update(visible=True), gr.update(visible=False), gr.update(visible=False)),
|
| 457 |
+
outputs=[upload_ui, form_ui, button_row],
|
| 458 |
).then(
|
| 459 |
# then handle the submission
|
| 460 |
fn=handle_submission,
|
|
|
|
| 500 |
).then(
|
| 501 |
# then hide the upload UI and show the main UI and submit button again
|
| 502 |
fn=lambda: (gr.update(visible=False), gr.update(visible=True), gr.update(visible=True)),
|
| 503 |
+
outputs=[upload_ui, form_ui, button_row],
|
| 504 |
+
)
|
| 505 |
+
|
| 506 |
+
skip_button.click(
|
| 507 |
+
# on skip, show the upload status UI and hide the main UI and submit button
|
| 508 |
+
fn=lambda: (gr.update(visible=True), gr.update(visible=False), gr.update(visible=False)),
|
| 509 |
+
outputs=[upload_ui, form_ui, button_row],
|
| 510 |
+
).then(
|
| 511 |
+
# then reload the user scenario data, fetching latest progress
|
| 512 |
+
init_interface,
|
| 513 |
+
inputs=[username, user_scenarios],
|
| 514 |
+
outputs=[
|
| 515 |
+
loader_ui,
|
| 516 |
+
status,
|
| 517 |
+
main_ui,
|
| 518 |
+
welcome_text,
|
| 519 |
+
scenario_idx_input,
|
| 520 |
+
scenario_input,
|
| 521 |
+
progress_display,
|
| 522 |
+
],
|
| 523 |
+
).then(
|
| 524 |
+
# then, clear form components except for the country select
|
| 525 |
+
fn=lambda: (
|
| 526 |
+
gr.update(value=None),
|
| 527 |
+
gr.update(value=None),
|
| 528 |
+
gr.update(value=None),
|
| 529 |
+
gr.update(value=None),
|
| 530 |
+
gr.update(value=None),
|
| 531 |
+
gr.update(value=None),
|
| 532 |
+
),
|
| 533 |
+
outputs=[audio_input, transcript_input, image_input, expected_output, satisfiable_radio, actual_output],
|
| 534 |
+
).then(
|
| 535 |
+
# then hide the upload UI and show the main UI and submit button again
|
| 536 |
+
fn=lambda: (gr.update(visible=False), gr.update(visible=True), gr.update(visible=True)),
|
| 537 |
+
outputs=[upload_ui, form_ui, button_row],
|
| 538 |
)
|
| 539 |
|
| 540 |
demo.load(load_user, None, outputs=[username, user_scenarios]).then(
|