import gradio as gr from dotenv import load_dotenv from research_manager import ResearchManager load_dotenv(override=True) async def run(query: str, email: str): async for chunk in ResearchManager().run(query, email=email): yield chunk with gr.Blocks(theme=gr.themes.Default(primary_hue="sky")) as ui: gr.Markdown("# Research and Email Sending Agent") gr.Markdown("### Ask a Question and provide your email id, the answer will be sent to your email.") gr.Markdown("### Please check your spam folder for the email from the agent. Also note that the LLM used here is not an advanced model, so it may produce some errors, but the email will still be sent") query_textbox = gr.Textbox(label="What topic would you like to research?") email_textbox = gr.Textbox(label="Enter your email address") run_button = gr.Button("Run", variant="primary") report = gr.Markdown(label="Report") run_button.click(fn=run, inputs=[query_textbox, email_textbox], outputs=report) query_textbox.submit(fn=run, inputs=[query_textbox, email_textbox], outputs=report) ui.launch(inbrowser=True)