Update app.py
Browse files
app.py
CHANGED
@@ -1,28 +1,17 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from generate import generate_response
|
3 |
|
4 |
-
|
5 |
-
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
-
|
|
|
1 |
+
# app.py
|
2 |
+
|
3 |
import gradio as gr
|
4 |
from generate import generate_response
|
5 |
|
6 |
+
def chat_fn(user_input):
|
7 |
+
return generate_response(user_input)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
+
iface = gr.Interface(
|
10 |
+
fn=chat_fn,
|
11 |
+
inputs=gr.Textbox(lines=2, placeholder="Ask Evo anything..."),
|
12 |
+
outputs="text",
|
13 |
+
title="🧠 EvoDecoder Chatbot",
|
14 |
+
description="A lightweight, custom-trained GPT-style decoder built from scratch."
|
15 |
+
)
|
16 |
|
17 |
+
iface.launch()
|