Update app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# app.py — EvoChat Gradio App
|
2 |
+
import gradio as gr
|
3 |
+
from generate import generate_response
|
4 |
+
|
5 |
+
DESCRIPTION = """
|
6 |
+
# 🤖 EvoChat
|
7 |
+
A lightweight, self-trained Transformer chatbot based on EvoDecoder architecture.
|
8 |
+
Model trained on 1K dialogue samples. Evolves from your feedback (v1).
|
9 |
+
"""
|
10 |
+
|
11 |
+
def chat_fn(message, history):
|
12 |
+
response = generate_response(message)
|
13 |
+
history.append((message, response))
|
14 |
+
return "", history
|
15 |
+
|
16 |
+
with gr.Blocks() as demo:
|
17 |
+
gr.Markdown(DESCRIPTION)
|
18 |
+
chatbot = gr.Chatbot()
|
19 |
+
with gr.Row():
|
20 |
+
msg = gr.Textbox(label="Your message")
|
21 |
+
submit = gr.Button("Send")
|
22 |
+
clear = gr.Button("Clear chat")
|
23 |
+
|
24 |
+
history = gr.State([])
|
25 |
+
|
26 |
+
submit.click(chat_fn, [msg, history], [msg, chatbot])
|
27 |
+
clear.click(lambda: [], None, chatbot)
|
28 |
+
|
29 |
+
demo.launch()
|