Spaces:
Runtime error
Runtime error
File size: 2,308 Bytes
083214f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | # ============================================================================
# app.py - FRONTEND
# ============================================================================
import gradio as gr
# Import backend functions and state management
from research_agent import process_message
# ============================================================================
# GRADIO APP DEFINITION
# ============================================================================
with gr.Blocks(title="Deep Research Agent") as demo:
# ============================================================================
# UI HEADER
# ============================================================================
gr.Markdown("# 🔬 Deep Research Assistant")
gr.Markdown("""
### How it works
1. Enter a research topic
2. The AI asks clarification questions
3. You answer them
4. The system performs deep research using RAG + Web
5. A structured report is generated
""")
# ============================================================================
# UI COMPONENTS
# ============================================================================
# Session state to track conversation across interactions
state = gr.State()
# Chatbot interface component
chatbot = gr.Chatbot()
# User input textbox
user_input = gr.Textbox(
placeholder="Enter your research topic or clarification...",
lines=2,
label="Your Message"
)
# Submit button
submit = gr.Button("Send")
# ============================================================================
# EVENT HANDLERS
# ============================================================================
# Wire button to processing function from backend
submit.click(
process_message, # Imported from research_agent.py
inputs=[user_input, chatbot, state],
outputs=[user_input, chatbot, state]
)
# ============================================================================
# APPLICATION ENTRY POINT
# ============================================================================
if __name__ == "__main__":
demo.launch() |