ehristoforu commited on
Commit
9735678
β€’
1 Parent(s): 6ab16a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -28,16 +28,14 @@ def predict(message, history, api_key):
28
  stream=True
29
  )
30
 
31
- partial_message = ""
32
  for chunk in response:
33
  if len(chunk['choices'][0]['delta']) != 0:
34
- partial_message = partial_message + chunk['choices'][0]['delta']['content']
 
35
  yield partial_message
36
 
37
-
38
-
39
-
40
- return response["choices"][0]["message"]["content"]
41
 
42
  title = "πŸ•Š Chat with Pigeon"
43
 
@@ -55,7 +53,7 @@ description = \
55
 
56
  πŸ‘₯️️ This demo is by **Evgeniy Hristoforu** (**OpenSkyML**).
57
 
58
- <h2></h2>
59
  """
60
 
61
 
@@ -69,5 +67,4 @@ examples=[
69
 
70
  chatbot = gr.Chatbot(label="PigeonChat",avatar_images=('user.png', 'bot.png'), min_width=260, show_share_button=False, show_copy_button=True, likeable=True, bubble_full_width = False)
71
 
72
-
73
- gr.ChatInterface(predict, chatbot = chatbot, title=title, description=description, examples=examples).launch(show_error=False, show_api=False)
 
28
  stream=True
29
  )
30
 
31
+ final_message = ""
32
  for chunk in response:
33
  if len(chunk['choices'][0]['delta']) != 0:
34
+ partial_message = chunk['choices'][0]['delta']['content']
35
+ final_message += partial_message
36
  yield partial_message
37
 
38
+ return final_message
 
 
 
39
 
40
  title = "πŸ•Š Chat with Pigeon"
41
 
 
53
 
54
  πŸ‘₯️️ This demo is by **Evgeniy Hristoforu** (**OpenSkyML**).
55
 
56
+
57
  """
58
 
59
 
 
67
 
68
  chatbot = gr.Chatbot(label="PigeonChat",avatar_images=('user.png', 'bot.png'), min_width=260, show_share_button=False, show_copy_button=True, likeable=True, bubble_full_width = False)
69
 
70
+ gr.ChatInterface(predict, chatbot = chatbot, title=title, description=description, examples=examples).launch(show_error=False, show_api=False)