Spaces:
Sleeping
Sleeping
Fix dataset dropdown initialization and auto-select first dataset
Browse files- Fix initialize_interface to return gr.Dropdown with choices
- Auto-select first dataset on interface load
- Add current_dataset_state to outputs for proper state management
- Resolves 'No dataset selected' error when clicking Load Dataset
src/interface/enhanced_verification_ui.py
CHANGED
|
@@ -527,9 +527,17 @@ class EnhancedVerificationUIComponents:
|
|
| 527 |
"""Initialize the interface with datasets and templates."""
|
| 528 |
dataset_choices, dataset_info, status_msg, templates = controller.initialize_interface()
|
| 529 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 530 |
return (
|
| 531 |
-
dataset_choices, # dataset_selector
|
| 532 |
dataset_info, # dataset_info_display
|
|
|
|
| 533 |
status_msg # status_message
|
| 534 |
)
|
| 535 |
|
|
@@ -761,6 +769,7 @@ class EnhancedVerificationUIComponents:
|
|
| 761 |
outputs=[
|
| 762 |
dataset_selector,
|
| 763 |
dataset_info_display,
|
|
|
|
| 764 |
status_message
|
| 765 |
]
|
| 766 |
)
|
|
|
|
| 527 |
"""Initialize the interface with datasets and templates."""
|
| 528 |
dataset_choices, dataset_info, status_msg, templates = controller.initialize_interface()
|
| 529 |
|
| 530 |
+
# Get first dataset info if available
|
| 531 |
+
first_dataset = None
|
| 532 |
+
if dataset_choices:
|
| 533 |
+
first_info, first_dataset = controller.get_dataset_info(dataset_choices[0])
|
| 534 |
+
dataset_info = first_info
|
| 535 |
+
|
| 536 |
+
# Return gr.Dropdown with choices to properly update the component
|
| 537 |
return (
|
| 538 |
+
gr.Dropdown(choices=dataset_choices, value=dataset_choices[0] if dataset_choices else None), # dataset_selector
|
| 539 |
dataset_info, # dataset_info_display
|
| 540 |
+
first_dataset, # current_dataset_state
|
| 541 |
status_msg # status_message
|
| 542 |
)
|
| 543 |
|
|
|
|
| 769 |
outputs=[
|
| 770 |
dataset_selector,
|
| 771 |
dataset_info_display,
|
| 772 |
+
current_dataset_state,
|
| 773 |
status_message
|
| 774 |
]
|
| 775 |
)
|