Spaces:
Runtime error
Runtime error
Download app.py from pythonpyro/deep-research-agent: direct link, hf CLI and curl.
- Browser
- Download file 2.31 kB
-
https://huggingface.co/spaces/pythonpyro/deep-research-agent/resolve/0d059e7d8bda83ca826d9ac9d105cd795ebbe9fc/app.py
- Command line
-
hf download hf://spaces/pythonpyro/deep-research-agent@0d059e7d8bda83ca826d9ac9d105cd795ebbe9fc/app.py
-
curl -L -o app.py https://huggingface.co/spaces/pythonpyro/deep-research-agent/resolve/0d059e7d8bda83ca826d9ac9d105cd795ebbe9fc/app.py
2.31 kB
| # ============================================================================ | |
| # 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() |