anaghanagesh's picture
Create app.py
bbe02f6 verified
Raw
History Blame Contribute Delete
1.34 kB
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)