K00B404 commited on
Commit
e358e48
·
verified ·
1 Parent(s): 67fee7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -72,7 +72,7 @@ def fetch_models(task):
72
  return [model.modelId for model in models]
73
  except Exception as e:
74
  return [f"Error fetching models: {str(e)}"]
75
-
76
  # Gradio Interface
77
  with gr.Blocks() as demo:
78
  gr.Markdown("## Hugging Face Chatbot with Dynamic Model Selection")
@@ -81,11 +81,11 @@ with gr.Blocks() as demo:
81
  with gr.Column():
82
  # Task selection
83
  task_selector = gr.Dropdown(
84
- choices=["text-generation", "image-classification", "text-classification", "translation"],
85
  label="Select Task",
86
  value="text-generation"
87
  )
88
-
89
  # Model selector
90
  model_selector = gr.Dropdown(choices=[], label="Select Model")
91
  # Example of handling model updates
 
72
  return [model.modelId for model in models]
73
  except Exception as e:
74
  return [f"Error fetching models: {str(e)}"]
75
+ task_choices=["text-generation", "image-classification", "text-classification", "translation"]
76
  # Gradio Interface
77
  with gr.Blocks() as demo:
78
  gr.Markdown("## Hugging Face Chatbot with Dynamic Model Selection")
 
81
  with gr.Column():
82
  # Task selection
83
  task_selector = gr.Dropdown(
84
+ choices=task_choices,
85
  label="Select Task",
86
  value="text-generation"
87
  )
88
+ models=fetch_models(task_choices[0])
89
  # Model selector
90
  model_selector = gr.Dropdown(choices=[], label="Select Model")
91
  # Example of handling model updates