commonlemon commited on
Commit
f2c93c1
·
verified ·
1 Parent(s): 8889ff3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
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 = "")