aifeifei798 commited on
Commit
f2bbaef
1 Parent(s): 81aac09

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -136,7 +136,7 @@ def predict(message, history, additional_dropdown):
136
  yield partial_message
137
 
138
  else:
139
- stream = client_more_ai.chat.completions.create(
140
  model=additional_dropdown,
141
  messages=[{"role": "user", "content": str(message_text)}],
142
  temperature=0.5,
@@ -147,9 +147,8 @@ def predict(message, history, additional_dropdown):
147
 
148
  partial_message = ""
149
  for chunk in stream_response:
150
- if chunk.data.choices[0].delta.content is not None:
151
- partial_message = partial_message + chunk.data.choices[0].delta.content
152
- yield partial_message
153
 
154
  with gr.Blocks(css=css) as demo:
155
  with gr.Row():
 
136
  yield partial_message
137
 
138
  else:
139
+ stream_response = client_more_ai.chat.completions.create(
140
  model=additional_dropdown,
141
  messages=[{"role": "user", "content": str(message_text)}],
142
  temperature=0.5,
 
147
 
148
  partial_message = ""
149
  for chunk in stream_response:
150
+ if chunk.choices[0].delta.content is not None:
151
+ yield chunk.choices[0].delta.content
 
152
 
153
  with gr.Blocks(css=css) as demo:
154
  with gr.Row():