Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -22,15 +22,12 @@ def chat_with_openai(input_text, gpt_model):
|
|
22 |
return str(e)
|
23 |
|
24 |
|
|
|
|
|
|
|
|
|
25 |
|
26 |
|
27 |
-
def on_submit(message, chat_history):
|
28 |
-
response = chat_with_openai(message)
|
29 |
-
chat_history.append((message, response))
|
30 |
-
return chat_history, ""
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
# Define the Gradio interface
|
35 |
with gr.Blocks(theme="Hev832/niceandsimple") as ui:
|
36 |
gr.Markdown("# ChatGPT Clone")
|
@@ -38,11 +35,9 @@ with gr.Blocks(theme="Hev832/niceandsimple") as ui:
|
|
38 |
chatbot = gr.Chatbot(label="OpenAI Chatbot")
|
39 |
with gr.Row():
|
40 |
msg = gr.Textbox(label="Enter your message here:")
|
41 |
-
model = gr.Dropdown(["gpt-4o-mini", "gpt-3.5-turbo", "
|
42 |
submit_btn = gr.Button("Submit")
|
43 |
|
44 |
-
|
45 |
-
|
46 |
submit_btn.click(on_submit, inputs=[msg, model, chatbot], outputs=[chatbot, msg])
|
47 |
|
48 |
# Launch the Gradio app
|
|
|
22 |
return str(e)
|
23 |
|
24 |
|
25 |
+
def on_submit(message, gpt_model, chat_history):
|
26 |
+
response = chat_with_openai(message, gpt_model)
|
27 |
+
chat_history.append((message, response))
|
28 |
+
return chat_history, ""
|
29 |
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
# Define the Gradio interface
|
32 |
with gr.Blocks(theme="Hev832/niceandsimple") as ui:
|
33 |
gr.Markdown("# ChatGPT Clone")
|
|
|
35 |
chatbot = gr.Chatbot(label="OpenAI Chatbot")
|
36 |
with gr.Row():
|
37 |
msg = gr.Textbox(label="Enter your message here:")
|
38 |
+
model = gr.Dropdown(["gpt-4o-mini", "gpt-3.5-turbo", "gpt-4o"], label="Your GPT model")
|
39 |
submit_btn = gr.Button("Submit")
|
40 |
|
|
|
|
|
41 |
submit_btn.click(on_submit, inputs=[msg, model, chatbot], outputs=[chatbot, msg])
|
42 |
|
43 |
# Launch the Gradio app
|