Spaces:
Sleeping
Sleeping
Download app.py from VIRAJcHOPADE/Research_Assistant: direct link, hf CLI and curl.
- Browser
- Download file 1.31 kB
-
https://huggingface.co/spaces/VIRAJcHOPADE/Research_Assistant/resolve/main/app.py
- Command line
-
hf download hf://spaces/VIRAJcHOPADE/Research_Assistant/app.py
-
curl -L -o app.py https://huggingface.co/spaces/VIRAJcHOPADE/Research_Assistant/resolve/main/app.py
1.31 kB
| import gradio as gr | |
| from dotenv import load_dotenv | |
| from research_manager import ResearchManager | |
| load_dotenv(override=True) | |
| async def run(query: str): | |
| progress_log = "" | |
| final_report = None | |
| async for chunk in ResearchManager().run(query): | |
| # Only update progress for status messages | |
| if "Searches" in chunk or "View trace" in chunk or "Email sent" in chunk: | |
| progress_log += chunk + "\n" | |
| yield progress_log, final_report | |
| else: | |
| # This is the final report | |
| final_report = chunk | |
| yield progress_log, final_report | |
| with gr.Blocks(theme=gr.themes.Default(primary_hue="sky")) as ui: | |
| gr.Markdown("# 🔎 Deep Research Assistant") | |
| query_textbox = gr.Textbox(label="What topic would you like to research?") | |
| run_button = gr.Button("Run Research", variant="primary") | |
| with gr.Row(): | |
| progress_box = gr.Textbox(label="Progress Log", lines=5) | |
| report_box = gr.Markdown(label="Final Report") | |
| run_button.click( | |
| fn=run, | |
| inputs=query_textbox, | |
| outputs=[progress_box,report_box], | |
| ) | |
| query_textbox.submit( | |
| fn=run, | |
| inputs=query_textbox, | |
| outputs=[progress_box,report_box], | |
| ) | |
| ui.launch(inbrowser=True) | |