Spaces:
Runtime error
Runtime error
ozipoetra commited on
Commit ·
e7d76ff
1
Parent(s): 9937fea
fix: handle model dropdown refresh when custom models exist
Browse files- Set default value when refreshing models to avoid Gradio error
- Prevents 'Value not in choices' error when model list changes
lib/ui.py
CHANGED
|
@@ -30,7 +30,8 @@ def upload_model(zip_file, model_name):
|
|
| 30 |
def refresh_models():
|
| 31 |
"""Refresh the models list."""
|
| 32 |
models = list_models()
|
| 33 |
-
|
|
|
|
| 34 |
|
| 35 |
|
| 36 |
def toggle_autotune(enabled):
|
|
|
|
| 30 |
def refresh_models():
|
| 31 |
"""Refresh the models list."""
|
| 32 |
models = list_models()
|
| 33 |
+
default_value = models[0] if models else None
|
| 34 |
+
return gr.update(value=[[m] for m in models]), gr.update(choices=models, value=default_value)
|
| 35 |
|
| 36 |
|
| 37 |
def toggle_autotune(enabled):
|