Spaces:
Sleeping
Sleeping
Fix Back to Mode Selection buttons functionality
Browse files- Add Back buttons at the top of each mode interface
- Create go_back_to_mode_selection helper function
- Bind click handlers for all three Back buttons
- Properly update interface visibility when returning to mode selection
- Resolves issue where Back buttons were not working
src/interface/enhanced_verification_interface.py
CHANGED
|
@@ -197,15 +197,33 @@ class EnhancedVerificationInterface:
|
|
| 197 |
# Individual mode interfaces (initially hidden)
|
| 198 |
enhanced_dataset_interface = gr.Row(visible=False)
|
| 199 |
with enhanced_dataset_interface:
|
| 200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
|
| 202 |
manual_input_interface = gr.Row(visible=False)
|
| 203 |
with manual_input_interface:
|
| 204 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
|
| 206 |
file_upload_interface = gr.Row(visible=False)
|
| 207 |
with file_upload_interface:
|
| 208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
|
| 210 |
# Event handlers
|
| 211 |
def initialize_interface():
|
|
@@ -511,6 +529,55 @@ class EnhancedVerificationInterface:
|
|
| 511 |
]
|
| 512 |
)
|
| 513 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 514 |
# Bind session resumption buttons
|
| 515 |
resume_session_btn.click(
|
| 516 |
resume_selected_session,
|
|
|
|
| 197 |
# Individual mode interfaces (initially hidden)
|
| 198 |
enhanced_dataset_interface = gr.Row(visible=False)
|
| 199 |
with enhanced_dataset_interface:
|
| 200 |
+
with gr.Column():
|
| 201 |
+
gr.Markdown("# 📊 Enhanced Dataset Mode")
|
| 202 |
+
gr.Markdown("Select and customize test datasets for verification.")
|
| 203 |
+
back_from_dataset_btn = gr.Button("← Back to Mode Selection", size="sm")
|
| 204 |
+
gr.Markdown("---")
|
| 205 |
+
# Embed the actual interface
|
| 206 |
+
enhanced_dataset_ui = EnhancedVerificationUIComponents.create_enhanced_dataset_interface_with_handlers()
|
| 207 |
|
| 208 |
manual_input_interface = gr.Row(visible=False)
|
| 209 |
with manual_input_interface:
|
| 210 |
+
with gr.Column():
|
| 211 |
+
gr.Markdown("# ✏️ Manual Input Mode")
|
| 212 |
+
gr.Markdown("Enter individual messages for immediate classification and verification.")
|
| 213 |
+
back_from_manual_btn = gr.Button("← Back to Mode Selection", size="sm")
|
| 214 |
+
gr.Markdown("---")
|
| 215 |
+
# Embed the actual interface
|
| 216 |
+
manual_input_ui = EnhancedVerificationUIComponents.create_manual_input_interface()
|
| 217 |
|
| 218 |
file_upload_interface = gr.Row(visible=False)
|
| 219 |
with file_upload_interface:
|
| 220 |
+
with gr.Column():
|
| 221 |
+
gr.Markdown("# 📁 File Upload Mode")
|
| 222 |
+
gr.Markdown("Upload CSV or XLSX files for batch processing.")
|
| 223 |
+
back_from_file_btn = gr.Button("← Back to Mode Selection", size="sm")
|
| 224 |
+
gr.Markdown("---")
|
| 225 |
+
# Embed the actual interface
|
| 226 |
+
file_upload_ui = EnhancedVerificationUIComponents.create_file_upload_interface()
|
| 227 |
|
| 228 |
# Event handlers
|
| 229 |
def initialize_interface():
|
|
|
|
| 529 |
]
|
| 530 |
)
|
| 531 |
|
| 532 |
+
# Helper function to go back to mode selection
|
| 533 |
+
def go_back_to_mode_selection():
|
| 534 |
+
"""Return to mode selection screen."""
|
| 535 |
+
return (
|
| 536 |
+
gr.Row(visible=True), # mode_selection_section
|
| 537 |
+
gr.Row(visible=False), # enhanced_dataset_interface
|
| 538 |
+
gr.Row(visible=False), # manual_input_interface
|
| 539 |
+
gr.Row(visible=False), # file_upload_interface
|
| 540 |
+
None, # current_mode_state
|
| 541 |
+
"✅ Returned to mode selection" # status_message
|
| 542 |
+
)
|
| 543 |
+
|
| 544 |
+
# Bind Back buttons for each mode
|
| 545 |
+
back_from_dataset_btn.click(
|
| 546 |
+
go_back_to_mode_selection,
|
| 547 |
+
outputs=[
|
| 548 |
+
mode_selection_section,
|
| 549 |
+
enhanced_dataset_interface,
|
| 550 |
+
manual_input_interface,
|
| 551 |
+
file_upload_interface,
|
| 552 |
+
current_mode_state,
|
| 553 |
+
status_message
|
| 554 |
+
]
|
| 555 |
+
)
|
| 556 |
+
|
| 557 |
+
back_from_manual_btn.click(
|
| 558 |
+
go_back_to_mode_selection,
|
| 559 |
+
outputs=[
|
| 560 |
+
mode_selection_section,
|
| 561 |
+
enhanced_dataset_interface,
|
| 562 |
+
manual_input_interface,
|
| 563 |
+
file_upload_interface,
|
| 564 |
+
current_mode_state,
|
| 565 |
+
status_message
|
| 566 |
+
]
|
| 567 |
+
)
|
| 568 |
+
|
| 569 |
+
back_from_file_btn.click(
|
| 570 |
+
go_back_to_mode_selection,
|
| 571 |
+
outputs=[
|
| 572 |
+
mode_selection_section,
|
| 573 |
+
enhanced_dataset_interface,
|
| 574 |
+
manual_input_interface,
|
| 575 |
+
file_upload_interface,
|
| 576 |
+
current_mode_state,
|
| 577 |
+
status_message
|
| 578 |
+
]
|
| 579 |
+
)
|
| 580 |
+
|
| 581 |
# Bind session resumption buttons
|
| 582 |
resume_session_btn.click(
|
| 583 |
resume_selected_session,
|