Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,10 +4,9 @@ import gradio as gr
|
|
| 4 |
model_id = "gpt-3.5-turbo"
|
| 5 |
|
| 6 |
# Getting responses using the OpenAI API
|
| 7 |
-
def answer_chatgpt(api_key, message, history, conversation
|
| 8 |
history = history or []
|
| 9 |
-
|
| 10 |
-
lista.append(message)
|
| 11 |
prompt = f"{message}"
|
| 12 |
conversation.append({"role": "user", "content": f"{prompt}"})
|
| 13 |
# OPENAI API KEY
|
|
@@ -33,7 +32,8 @@ with block:
|
|
| 33 |
chatbot = gr.Chatbot()
|
| 34 |
message = gr.Textbox(placeholder="message")
|
| 35 |
state = gr.State()
|
|
|
|
| 36 |
submit = gr.Button("Send")
|
| 37 |
-
submit.click(answer_chatgpt, inputs=[api_key, message, state], outputs=[chatbot, state])
|
| 38 |
|
| 39 |
block.launch(debug=True)
|
|
|
|
| 4 |
model_id = "gpt-3.5-turbo"
|
| 5 |
|
| 6 |
# Getting responses using the OpenAI API
|
| 7 |
+
def answer_chatgpt(api_key, message, history, conversation):
|
| 8 |
history = history or []
|
| 9 |
+
conversation = conversation or []
|
|
|
|
| 10 |
prompt = f"{message}"
|
| 11 |
conversation.append({"role": "user", "content": f"{prompt}"})
|
| 12 |
# OPENAI API KEY
|
|
|
|
| 32 |
chatbot = gr.Chatbot()
|
| 33 |
message = gr.Textbox(placeholder="message")
|
| 34 |
state = gr.State()
|
| 35 |
+
memories = gr.State()
|
| 36 |
submit = gr.Button("Send")
|
| 37 |
+
submit.click(answer_chatgpt, inputs=[api_key, message, state, memories], outputs=[chatbot, state])
|
| 38 |
|
| 39 |
block.launch(debug=True)
|