TobDeBer commited on
Commit
23c2ad6
·
1 Parent(s): 3dae197
Files changed (1) hide show
  1. app_local.py +9 -27
app_local.py CHANGED
@@ -86,31 +86,22 @@ def respond(
86
  description = """<p align="center">Defaults to Qwen 500M</p>
87
  """
88
 
89
- # Create a shared state variable to store the selected model
90
- selected_model = gr.State("mistrallite.Q4_K_M.gguf")
91
-
92
- # Create a separate interface for model selection
93
- model_selection = gr.Interface(
94
- fn=None, # No function needed for model selection
95
- inputs=[
96
- gr.Dropdown([
97
- 'qwen2-0_5b-instruct-q4_k_m.gguf',
98
- 'qwen2_500m.gguf',
99
- 'mistrallite.Q4_K_M.gguf',
100
- ],
101
- value="qwen2-0_5b-instruct-q4_k_m.gguf",
102
- label="Model"
103
- ),
104
  ],
105
- outputs=None, # Add a dummy output
106
- title="Select Model",
107
  )
108
 
109
  # Create the main chat interface
110
  demo = gr.ChatInterface(
111
  respond,
112
  additional_inputs=[
113
- selected_model, # Pass the selected_model state variable as an input
114
  gr.Textbox(value="You are a helpful assistant.", label="System message"),
115
  gr.Slider(minimum=1, maximum=4096, value=2048, step=1, label="Max tokens"),
116
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
@@ -147,13 +138,4 @@ demo = gr.ChatInterface(
147
  likeable=False,
148
  show_copy_button=True
149
  )
150
- )
151
-
152
- gr.TabbedInterface(
153
- [model_selection, demo],
154
- tab_names=["Model Selection", "Demo"],
155
  ).launch()
156
-
157
- # Launch the model selection interface
158
- #if __name__ == "__main__":
159
- # model_selection.launch()
 
86
  description = """<p align="center">Defaults to Qwen 500M</p>
87
  """
88
 
89
+ # Dropdown for Model Selection
90
+ model_dropdown = gr.Dropdown(
91
+ [
92
+ 'qwen2-0_5b-instruct-q4_k_m.gguf',
93
+ 'qwen2_500m.gguf',
94
+ 'mistrallite.Q4_K_M.gguf',
 
 
 
 
 
 
 
 
 
95
  ],
96
+ value="qwen2-0_5b-instruct-q4_k_m.gguf",
97
+ label="Model"
98
  )
99
 
100
  # Create the main chat interface
101
  demo = gr.ChatInterface(
102
  respond,
103
  additional_inputs=[
104
+ model_dropdown, # Pass the selected model from Dropdown
105
  gr.Textbox(value="You are a helpful assistant.", label="System message"),
106
  gr.Slider(minimum=1, maximum=4096, value=2048, step=1, label="Max tokens"),
107
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
 
138
  likeable=False,
139
  show_copy_button=True
140
  )
 
 
 
 
 
141
  ).launch()