HemanM commited on
Commit
56c5819
·
verified ·
1 Parent(s): c180692

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -18
app.py CHANGED
@@ -2,29 +2,27 @@ import gradio as gr
2
  from generate import generate_response
3
 
4
  description = """
5
- ### 🤖 EvoDecoder Chatbot
6
- Powered by a lightweight, GPT-style evolved Transformer (EvoDecoder) trained from scratch.
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
- user_input = gr.Textbox(placeholder="Type a message...", scale=4)
19
- send_btn = gr.Button("Send", scale=1)
20
-
21
- history = []
22
-
23
- def respond(message):
24
- response = generate_response(message)
25
- history.append((message, response))
26
- return history, ""
27
 
28
- send_btn.click(fn=respond, inputs=user_input, outputs=[chatbot, user_input])
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()