Spaces:
Sleeping

deep_research / deep_research1.py
lemosryan007's picture
Upload folder using huggingface_hub
f233663 verified
Raw History Blame Contribute Delete
1.06 kB
import gradio as gr
from dotenv import load_dotenv
from research1_manager import ResearchManager
load_dotenv(override=True)
# Async generator for streaming output from ResearchManager
async def run(query: str):
try:
async for chunk in ResearchManager().run(query):
yield chunk
except Exception as e:
yield f"**Error:** {e!s}"
with gr.Blocks(theme=gr.themes.Default(primary_hue="sky")) as ui:
gr.Markdown("# 🔎 Deep Research (Display Only — No Email)")
query_textbox = gr.Textbox(
label="What topic would you like to research?",
placeholder="e.g. Impact of AI on global logistics",
lines=2,
)
run_button = gr.Button("Run Research", variant="primary")
report = gr.Markdown("")
# Bind both click and Enter key events
run_button.click(fn=run, inputs=query_textbox, outputs=report)
query_textbox.submit(fn=run, inputs=query_textbox, outputs=report)
# New API: just call queue() with no args
if __name__ == "__main__":
ui.queue().launch(inbrowser=True)