expandme commited on
Commit
001fc24
1 Parent(s): 1ad60df

Messed up ? - What wind.surf will do ?

Browse files
Files changed (1) hide show
  1. app.py +12 -16
app.py CHANGED
@@ -23,22 +23,16 @@ def load_model(model_name):
23
  current_model = Llama.from_pretrained(
24
  repo_id=model_info["repo_id"],
25
  filename=model_info["filename"],
26
- verbose=True,
27
- n_ctx=32768,
28
- n_threads=2,
29
- chat_format="chatml"
30
- )
31
  return current_model
32
 
33
  # Initialize with first model
34
  current_model = load_model(list(MODELS.keys())[0])
35
 
36
- def get_description(model_name):
37
- return f"🤖 Current Model: {model_name}\n\nTry models locclay in: 🖥️ [LM Studio AI for PC](https://lmstudio.ai) | 📱 PocketPal AI ([Android](https://play.google.com/store/apps/details?id=com.pocketpalai) & [iOS](https://play.google.com/store/apps/details?id=com.pocketpalai)) on Tablet or Mobile"
38
-
39
- def update_description(model_name):
40
- return get_description(model_name)
41
-
42
  def respond(
43
  message,
44
  history: list[tuple[str, str]],
@@ -53,7 +47,7 @@ def respond(
53
  # Load new model if changed
54
  if current_model is None or model_name != current_model.model_path:
55
  current_model = load_model(model_name)
56
-
57
  messages = [{"role": "system", "content": system_message}]
58
 
59
  for val in history:
@@ -90,9 +84,7 @@ demo = gr.ChatInterface(
90
  gr.Dropdown(
91
  choices=list(MODELS.keys()),
92
  value=list(MODELS.keys())[0],
93
- label="Select Model",
94
- interactive=False,
95
- allow_custom_value=False
96
  ),
97
  gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
98
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
@@ -153,10 +145,14 @@ demo = gr.ChatInterface(
153
 
154
 
155
  if __name__ == "__main__":
 
156
  with gr.Blocks() as blocks:
157
  chatbot = demo.render()
158
  # Get the model dropdown component
159
  model_dropdown = [comp for comp in chatbot.children if isinstance(comp, gr.Dropdown)][0]
160
  # Add event handler for model change
161
  model_dropdown.change(fn=lambda x: None, inputs=[model_dropdown], outputs=[])
162
- blocks.launch()
 
 
 
 
23
  current_model = Llama.from_pretrained(
24
  repo_id=model_info["repo_id"],
25
  filename=model_info["filename"],
26
+ verbose=True,
27
+ n_ctx=32768,
28
+ n_threads=2,
29
+ chat_format="chatml"
30
+ )
31
  return current_model
32
 
33
  # Initialize with first model
34
  current_model = load_model(list(MODELS.keys())[0])
35
 
 
 
 
 
 
 
36
  def respond(
37
  message,
38
  history: list[tuple[str, str]],
 
47
  # Load new model if changed
48
  if current_model is None or model_name != current_model.model_path:
49
  current_model = load_model(model_name)
50
+
51
  messages = [{"role": "system", "content": system_message}]
52
 
53
  for val in history:
 
84
  gr.Dropdown(
85
  choices=list(MODELS.keys()),
86
  value=list(MODELS.keys())[0],
87
+ label="Select Model"
 
 
88
  ),
89
  gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
90
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
 
145
 
146
 
147
  if __name__ == "__main__":
148
+ <<<<<<< HEAD
149
  with gr.Blocks() as blocks:
150
  chatbot = demo.render()
151
  # Get the model dropdown component
152
  model_dropdown = [comp for comp in chatbot.children if isinstance(comp, gr.Dropdown)][0]
153
  # Add event handler for model change
154
  model_dropdown.change(fn=lambda x: None, inputs=[model_dropdown], outputs=[])
155
+ blocks.launch()
156
+ =======
157
+ demo.launch()
158
+ >>>>>>> parent of 617316d (List of models ? - What wind.surf will do ?)