Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -50,6 +50,15 @@ def get_prompt(name):
|
|
50 |
"""Retrieve a system prompt by name."""
|
51 |
return system_prompts.get(name, "")
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
def fetch_models(task):
|
54 |
"""Fetch models for a specific task from Hugging Face Hub."""
|
55 |
try:
|
@@ -79,6 +88,9 @@ with gr.Blocks() as demo:
|
|
79 |
|
80 |
# Model selector
|
81 |
model_selector = gr.Dropdown(choices=[], label="Select Model")
|
|
|
|
|
|
|
82 |
|
83 |
# System prompt and input
|
84 |
system_prompt_name = gr.Dropdown(choices=list(system_prompts.keys()), label="Select System Prompt")
|
|
|
50 |
"""Retrieve a system prompt by name."""
|
51 |
return system_prompts.get(name, "")
|
52 |
|
53 |
+
|
54 |
+
def update_dropdown_choices(models):
|
55 |
+
"""Update dropdown choices dynamically."""
|
56 |
+
if not models:
|
57 |
+
return [], None # Return empty choices and no default value
|
58 |
+
return models, models[0]
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
def fetch_models(task):
|
63 |
"""Fetch models for a specific task from Hugging Face Hub."""
|
64 |
try:
|
|
|
88 |
|
89 |
# Model selector
|
90 |
model_selector = gr.Dropdown(choices=[], label="Select Model")
|
91 |
+
# Example of handling model updates
|
92 |
+
model_selector.choices = available_models
|
93 |
+
model_selector.value = available_models[0]
|
94 |
|
95 |
# System prompt and input
|
96 |
system_prompt_name = gr.Dropdown(choices=list(system_prompts.keys()), label="Select System Prompt")
|