Spaces:
Running
on
Zero
Running
on
Zero
aifeifei798
commited on
Commit
•
71224a5
1
Parent(s):
f2bbaef
Update app.py
Browse files
app.py
CHANGED
@@ -136,7 +136,7 @@ def predict(message, history, additional_dropdown):
|
|
136 |
yield partial_message
|
137 |
|
138 |
else:
|
139 |
-
|
140 |
model=additional_dropdown,
|
141 |
messages=[{"role": "user", "content": str(message_text)}],
|
142 |
temperature=0.5,
|
@@ -146,10 +146,12 @@ def predict(message, history, additional_dropdown):
|
|
146 |
)
|
147 |
|
148 |
partial_message = ""
|
149 |
-
|
|
|
150 |
if chunk.choices[0].delta.content is not None:
|
151 |
-
|
152 |
-
|
|
|
153 |
with gr.Blocks(css=css) as demo:
|
154 |
with gr.Row():
|
155 |
with gr.Column(scale=1):
|
|
|
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,
|
|
|
146 |
)
|
147 |
|
148 |
partial_message = ""
|
149 |
+
temp = ""
|
150 |
+
for chunk in stream:
|
151 |
if chunk.choices[0].delta.content is not None:
|
152 |
+
temp += chunk.choices[0].delta.content
|
153 |
+
yield temp
|
154 |
+
|
155 |
with gr.Blocks(css=css) as demo:
|
156 |
with gr.Row():
|
157 |
with gr.Column(scale=1):
|