Spaces:
Sleeping
Sleeping
Update chatbot.py
Browse files- chatbot.py +10 -5
chatbot.py
CHANGED
|
@@ -20,9 +20,10 @@ def chatbot(input):
|
|
| 20 |
if input:
|
| 21 |
chatbot.messages.append({"role": "user", "content": input})
|
| 22 |
chat = openai.ChatCompletion.create(
|
| 23 |
-
model="gpt-3.5-turbo
|
|
|
|
| 24 |
)
|
| 25 |
-
reply = chat.choices[0].message
|
| 26 |
chatbot.messages.append({"role": "assistant", "content": reply})
|
| 27 |
|
| 28 |
conversation = ""
|
|
@@ -35,6 +36,10 @@ def chatbot(input):
|
|
| 35 |
inputs = gr.Textbox(lines=7, label="Chat with AttachmentBot")
|
| 36 |
outputs = gr.Textbox(label="Conversation")
|
| 37 |
|
| 38 |
-
gr.Interface(
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
if input:
|
| 21 |
chatbot.messages.append({"role": "user", "content": input})
|
| 22 |
chat = openai.ChatCompletion.create(
|
| 23 |
+
model="gpt-3.5-turbo",
|
| 24 |
+
messages=chatbot.messages
|
| 25 |
)
|
| 26 |
+
reply = chat.choices[0].message["content"]
|
| 27 |
chatbot.messages.append({"role": "assistant", "content": reply})
|
| 28 |
|
| 29 |
conversation = ""
|
|
|
|
| 36 |
inputs = gr.Textbox(lines=7, label="Chat with AttachmentBot")
|
| 37 |
outputs = gr.Textbox(label="Conversation")
|
| 38 |
|
| 39 |
+
gr.Interface(
|
| 40 |
+
fn=chatbot,
|
| 41 |
+
inputs=inputs,
|
| 42 |
+
outputs=outputs,
|
| 43 |
+
title="AttachmentBot",
|
| 44 |
+
description="Let me survey you about your attachment with certain people in your life, to begin enter start"
|
| 45 |
+
).launch()
|