Update app.py
Browse files
app.py
CHANGED
|
@@ -64,7 +64,7 @@ def clear_chat():
|
|
| 64 |
"""
|
| 65 |
Clear the chat history.
|
| 66 |
"""
|
| 67 |
-
return []
|
| 68 |
|
| 69 |
# Gradio Interface
|
| 70 |
# =================
|
|
@@ -73,7 +73,7 @@ def gradio_interface():
|
|
| 73 |
Create and launch the Gradio interface.
|
| 74 |
"""
|
| 75 |
with gr.Blocks() as demo:
|
| 76 |
-
chatbot = gr.Chatbot(label="Chat with Qwen/Qwen2.5-Coder-0.5B-Instruct")
|
| 77 |
msg = gr.Textbox(label="User Input")
|
| 78 |
clear = gr.Button("Clear Chat")
|
| 79 |
|
|
@@ -81,10 +81,10 @@ def gradio_interface():
|
|
| 81 |
chat_history.append({"role": "user", "content": message})
|
| 82 |
response = generate_response(message, chat_history)
|
| 83 |
chat_history.append({"role": "assistant", "content": response})
|
| 84 |
-
return chat_history
|
| 85 |
|
| 86 |
-
msg.submit(respond, [msg, chatbot], [chatbot
|
| 87 |
-
clear.click(clear_chat, None, [chatbot
|
| 88 |
|
| 89 |
demo.launch()
|
| 90 |
|
|
|
|
| 64 |
"""
|
| 65 |
Clear the chat history.
|
| 66 |
"""
|
| 67 |
+
return []
|
| 68 |
|
| 69 |
# Gradio Interface
|
| 70 |
# =================
|
|
|
|
| 73 |
Create and launch the Gradio interface.
|
| 74 |
"""
|
| 75 |
with gr.Blocks() as demo:
|
| 76 |
+
chatbot = gr.Chatbot(label="Chat with Qwen/Qwen2.5-Coder-0.5B-Instruct", type="messages")
|
| 77 |
msg = gr.Textbox(label="User Input")
|
| 78 |
clear = gr.Button("Clear Chat")
|
| 79 |
|
|
|
|
| 81 |
chat_history.append({"role": "user", "content": message})
|
| 82 |
response = generate_response(message, chat_history)
|
| 83 |
chat_history.append({"role": "assistant", "content": response})
|
| 84 |
+
return chat_history
|
| 85 |
|
| 86 |
+
msg.submit(respond, [msg, chatbot], [chatbot])
|
| 87 |
+
clear.click(clear_chat, None, [chatbot])
|
| 88 |
|
| 89 |
demo.launch()
|
| 90 |
|