Update app.py
Browse files
app.py
CHANGED
|
@@ -2,29 +2,27 @@ import gradio as gr
|
|
| 2 |
from generate import generate_response
|
| 3 |
|
| 4 |
description = """
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
- Trained on dialogue data
|
| 9 |
-
- Uses 6 decoder blocks (512-dim, 8 heads)
|
| 10 |
-
- Fine-tuned to respond to real prompts
|
| 11 |
-
|
| 12 |
"""
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
with gr.Blocks() as demo:
|
| 15 |
gr.Markdown(description)
|
| 16 |
-
chatbot = gr.Chatbot(height=400)
|
| 17 |
with gr.Row():
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
def respond(message):
|
| 24 |
-
response = generate_response(message)
|
| 25 |
-
history.append((message, response))
|
| 26 |
-
return history, ""
|
| 27 |
|
| 28 |
-
|
| 29 |
|
| 30 |
demo.launch()
|
|
|
|
| 2 |
from generate import generate_response
|
| 3 |
|
| 4 |
description = """
|
| 5 |
+
# 🧠 EvoDecoder Chatbot
|
| 6 |
+
This chatbot is powered by **EvoDecoder**, a lightweight GPT-style Transformer trained on a small dataset.
|
| 7 |
+
Ask any question and Evo will respond using its own learned weights (no OpenAI involved).
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
"""
|
| 9 |
|
| 10 |
+
def chat(prompt):
|
| 11 |
+
try:
|
| 12 |
+
response = generate_response(prompt)
|
| 13 |
+
return response if response else "(No response generated)"
|
| 14 |
+
except Exception as e:
|
| 15 |
+
return f"⚠️ Error: {str(e)}"
|
| 16 |
+
|
| 17 |
with gr.Blocks() as demo:
|
| 18 |
gr.Markdown(description)
|
|
|
|
| 19 |
with gr.Row():
|
| 20 |
+
with gr.Column():
|
| 21 |
+
input_box = gr.Textbox(label="Ask Evo", placeholder="Type a question here...")
|
| 22 |
+
submit_btn = gr.Button("Generate")
|
| 23 |
+
with gr.Column():
|
| 24 |
+
output_box = gr.Textbox(label="Evo's Response")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
submit_btn.click(fn=chat, inputs=input_box, outputs=output_box)
|
| 27 |
|
| 28 |
demo.launch()
|