Spaces:
Paused
Paused
Commit
ยท
9735678
1
Parent(s):
6ab16a9
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,16 +28,14 @@ def predict(message, history, api_key):
|
|
| 28 |
stream=True
|
| 29 |
)
|
| 30 |
|
| 31 |
-
|
| 32 |
for chunk in response:
|
| 33 |
if len(chunk['choices'][0]['delta']) != 0:
|
| 34 |
-
partial_message =
|
|
|
|
| 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 |
-
|
| 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)
|
|
|