Spaces:
Runtime error
Runtime error
| 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) |