Macdensten91 commited on
Commit
5bd0fe8
·
verified ·
1 Parent(s): 15a8293

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -14
app.py CHANGED
@@ -191,20 +191,19 @@ def respond(message, history: list, system_message, max_tokens, temperature, top
191
  messages_list.append({"role": "user", "content": message})
192
 
193
  # Generate the assistant's answer by streaming responses.
194
- response_text = ""
195
- for partial_response in client.chat_completion(
196
- messages_list,
197
- max_tokens=max_tokens,
198
- stream=True,
199
- temperature=temperature,
200
- top_p=top_p,
201
- ):
202
- if partial_response.choices and partial_response.choices[0].delta:
203
- token = partial_response.choices[0].delta.content
204
- if token:
205
- response_text += token
206
- yield response_text
207
-
208
  # --- Gradio Chat Interface ---
209
  demo = gr.ChatInterface(
210
  fn=respond,
 
191
  messages_list.append({"role": "user", "content": message})
192
 
193
  # Generate the assistant's answer by streaming responses.
194
+ response_text = ""
195
+ for partial_response in client.chat_completion(
196
+ messages_list,
197
+ max_tokens=1024,
198
+ stream=True,
199
+ temperature=temperature,
200
+ top_p=top_p,
201
+ ):
202
+ if partial_response.choices and partial_response.choices[0].delta:
203
+ token = partial_response.choices[0].delta.content
204
+ if token:
205
+ response_text += token
206
+ yield response_text
 
207
  # --- Gradio Chat Interface ---
208
  demo = gr.ChatInterface(
209
  fn=respond,