import gradio as gr from agents import run_pipeline def analyze(symptoms, audio_file): try: result = run_pipeline(symptoms, audio_file) molecule_html = "" if result["molecule_html"]: molecule_html = result["molecule_html"] return ( result["analysis"], result["pubmed"], molecule_html ) except Exception as e: return ( f"โŒ System Error\n\n{str(e)}", "Error", "" ) with gr.Blocks(theme=gr.themes.Soft()) as demo: gr.Markdown(""" # ๐Ÿงฌ AI Biomedical Assistant ### AI-Powered Clinical Intelligence & Drug Discovery Platform """) symptoms = gr.Textbox( label="๐Ÿฉบ Symptoms", placeholder="Example: headache, nausea, fever, chest pain" ) audio = gr.Audio( sources=["upload", "microphone"], type="filepath", label="๐ŸŽ™๏ธ Voice Input" ) btn = gr.Button("๐Ÿง  Analyze") output = gr.Markdown(label="Biomedical Analysis") pubmed = gr.Markdown(label="๐Ÿ“„ PubMed Research") molecule = gr.HTML(label="๐Ÿงช 3D Drug Molecule") btn.click( fn=analyze, inputs=[symptoms, audio], outputs=[output, pubmed, molecule] ) demo.launch(server_name="0.0.0.0", server_port=7860)