File size: 937 Bytes
51e5b61
e557b05
 
 
51e5b61
 
 
 
 
 
 
 
b19b35a
51e5b61
 
 
 
b19b35a
51e5b61
 
b19b35a
5a8590e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# app.py — EvoDecoder Chat UI with optional web search toggle
import gradio as gr
from generate import generate_response

def chat_fn(message, chat_history, web_flag):
    response = generate_response(message, use_web=web_flag)
    chat_history.append({"role": "user", "content": message})
    chat_history.append({"role": "assistant", "content": response})
    return "", chat_history

with gr.Blocks(title="EvoDecoder RAG Chatbot") as demo:
    gr.Markdown("🧠 **Chat with EvoDecoder — Lightweight Conversational AI**")

    chatbot = gr.Chatbot(label="Chat with Evo", type="messages", height=400)
    msg = gr.Textbox(placeholder="Ask Evo anything...", label="Your message")
    web_flag = gr.Checkbox(label="🔎 Use Web Search (RAG)", value=True)
    clear_btn = gr.Button("Clear")

    msg.submit(chat_fn, [msg, chatbot, web_flag], [msg, chatbot])
    clear_btn.click(lambda: ([], ""), outputs=[chatbot, msg])

demo.launch()