jmc310/deep_research
0
1import gradio as gr
2from dotenv import load_dotenv
3import os
4from research_manager import ResearchManager
5
6# Try to load .env file if it exists, but don't fail if it doesn't
7load_dotenv(override=True, verbose=True)
8
9# You can add any environment variable checks here
10# For example:
11# if not os.getenv("OPENAI_API_KEY"):
12# print("Warning: OPENAI_API_KEY not found in environment variables")
13
14async def run(query: str):
15 async for chunk in ResearchManager().run(query):
16 yield chunk
17
18with gr.Blocks(theme=gr.themes.Default(primary_hue="sky")) as ui:
19 gr.Markdown("# Deep Research")
20 query_textbox = gr.Textbox(label="What topic would you like to research?")
21 run_button = gr.Button("Run", variant="primary")
22 report = gr.Markdown(label="Report")
23
24 run_button.click(fn=run, inputs=query_textbox, outputs=report)
25 query_textbox.submit(fn=run, inputs=query_textbox, outputs=report)
26
27ui.launch()
28
29 