Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,9 +28,10 @@ def respond(message, history):
|
|
| 28 |
temperature = 0.5,
|
| 29 |
stream = True):
|
| 30 |
|
| 31 |
-
token = message.choices[0].delta.content
|
| 32 |
-
response += token
|
| 33 |
-
yield response
|
|
|
|
| 34 |
|
| 35 |
# defining chatbot
|
| 36 |
chatbot = gr.ChatInterface(respond, title = "", description = "")
|
|
|
|
| 28 |
temperature = 0.5,
|
| 29 |
stream = True):
|
| 30 |
|
| 31 |
+
token = message.choices[0].delta.content #extracts the new token (word/character - like "add") that just arrived
|
| 32 |
+
response += token #adding token onto response, like a snowball effect
|
| 33 |
+
yield response #not 'return response -- return would end loop & return only 1st some tokens that are printed
|
| 34 |
+
#yield - sends current 'response' back to Gradio -> Gradio updates chatbot screen, then waits for next turn of loop
|
| 35 |
|
| 36 |
# defining chatbot
|
| 37 |
chatbot = gr.ChatInterface(respond, title = "", description = "")
|