EvoConvo / app.py
HemanM's picture
Update app.py
5a8590e verified
raw
history blame
961 Bytes
# app.py — Gradio interface to chat with EvoDecoder + live web search (RAG)
import gradio as gr
from generate import generate_response
with gr.Blocks(title="🧠 EvoDecoder — Lightweight Conversational AI") as demo:
gr.Markdown("## 🧠 Chat with EvoDecoder — Lightweight Conversational AI with Live Search (RAG)")
chatbot = gr.Chatbot(label="Evo Chat", type="messages")
msg = gr.Textbox(label="Ask Evo anything...")
use_web = gr.Checkbox(label="Use Web Search (RAG)?", value=True)
clear = gr.Button("Clear")
def chat_fn(user_message, chat_history, web_flag):
response = generate_response(user_message, use_web=web_flag)
chat_history.append({"role": "user", "content": user_message})
chat_history.append({"role": "assistant", "content": response})
return "", chat_history
msg.submit(chat_fn, [msg, chatbot, use_web], [msg, chatbot])
clear.click(lambda: [], None, chatbot)
demo.launch()