import gradio as gr from crew import run_lead_gen def generate_leads(target_audience, service, sender_name): if not target_audience or not service or not sender_name: return "Please fill in all fields.", "Idle" # This call is synchronous, but gradio will show progress once a long-running request starts. result = run_lead_gen(target_audience, service, sender_name) return result, "Completed" with gr.Blocks(title="AI Lead Gen Agent") as ui: gr.Markdown("# 🤖 AI Lead Generation & Outreach Agent") gr.Markdown("Find leads and generate personalized outreach messages automatically") with gr.Row(): with gr.Column(): target_input = gr.Textbox( label="Target Audience", placeholder="e.g. digital marketing agencies in London" ) service_input = gr.Textbox( label="Your Service", placeholder="e.g. I build AI automation tools for businesses" ) name_input = gr.Textbox( label="Your Name", placeholder="e.g. Uche" ) run_btn = gr.Button("Generate Leads", variant="primary") status = gr.Textbox(label="Progress", interactive=False, value="Idle") output = gr.Markdown() run_btn.click( fn=generate_leads, inputs=[target_input, service_input, name_input], outputs=[output, status], show_progress=True ) ui.launch()