Spaces:
Sleeping
Sleeping
shambhavisrege commited on
Commit ·
8e1cb2b
1
Parent(s): 088dc77
Update App
Browse files
app.py
CHANGED
|
@@ -1,21 +1,25 @@
|
|
| 1 |
import openai
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
-
openai.api_key = "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"
|
| 5 |
|
| 6 |
-
messages = [
|
| 7 |
-
|
| 8 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
def chatbot(input):
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
chat = openai.ChatCompletion.create(
|
| 14 |
-
model="gpt-3.5-turbo", messages=messages
|
| 15 |
-
)
|
| 16 |
-
reply = chat.choices[0].message.content
|
| 17 |
-
messages.append({"role": "assistant", "content": reply})
|
| 18 |
-
return reply
|
| 19 |
|
| 20 |
inputs = gr.Textbox(lines=7, label="Chat with AI")
|
| 21 |
outputs = gr.Textbox(label="Reply")
|
|
|
|
| 1 |
import openai
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
# openai.api_key = "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"
|
| 5 |
|
| 6 |
+
# messages = [
|
| 7 |
+
# {"role": "system", "content": "You are a helpful and kind AI Assistant."},
|
| 8 |
+
# ]
|
| 9 |
+
|
| 10 |
+
# def chatbot(input):
|
| 11 |
+
# if input:
|
| 12 |
+
# messages.append({"role": "user", "content": input})
|
| 13 |
+
# chat = openai.ChatCompletion.create(
|
| 14 |
+
# model="gpt-3.5-turbo", messages=messages
|
| 15 |
+
# )
|
| 16 |
+
# reply = chat.choices[0].message.content
|
| 17 |
+
# messages.append({"role": "assistant", "content": reply})
|
| 18 |
+
# return reply
|
| 19 |
|
| 20 |
def chatbot(input):
|
| 21 |
+
reply = 'Hi how are you doing?'
|
| 22 |
+
return reply
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
inputs = gr.Textbox(lines=7, label="Chat with AI")
|
| 25 |
outputs = gr.Textbox(label="Reply")
|