Spaces:
Sleeping
Sleeping
Update app.py
#1
by isabelle7 - opened
app.py
CHANGED
|
@@ -14,9 +14,10 @@ def respond(message, history):
|
|
| 14 |
"content": message
|
| 15 |
})
|
| 16 |
response = ""
|
| 17 |
-
for msg in client.chat_completion(messages, max_tokens=200, temperature=1, top_p=0.5):
|
|
|
|
| 18 |
response += msg
|
| 19 |
-
yield response
|
| 20 |
|
| 21 |
chatbot = gr.ChatInterface(fn=respond, title="Magic 8 Ball", description="Discover your fortune...", editable=True)
|
| 22 |
chatbot.launch()
|
|
|
|
| 14 |
"content": message
|
| 15 |
})
|
| 16 |
response = ""
|
| 17 |
+
for msg in client.chat_completion(messages, max_tokens=200, temperature=1, top_p=0.5, stream = True):
|
| 18 |
+
token = msg.choices[0].delta.content
|
| 19 |
response += msg
|
| 20 |
+
yield response
|
| 21 |
|
| 22 |
chatbot = gr.ChatInterface(fn=respond, title="Magic 8 Ball", description="Discover your fortune...", editable=True)
|
| 23 |
chatbot.launch()
|