import gradio as gr def detect_risk(symptoms): text = symptoms.lower() if "chest pain" in text or "difficulty breathing" in text: return "🔴 HIGH" if "high fever" in text or "vomiting" in text: return "🟠 MEDIUM" return "🟢 LOW" def analyze(symptoms): risk = detect_risk(symptoms) return f""" Risk Level: {risk} Possible Conditions: - Based on the symptoms provided, further medical evaluation may be needed. Basic Guidance: - Rest adequately - Stay hydrated - Monitor symptoms Emergency Warning: - Seek medical attention if symptoms worsen or become severe. ⚠️ Disclaimer: This tool is for educational purposes only and is not a medical diagnosis. """ with gr.Blocks() as demo: gr.Markdown("# 🩺 MediGuide AI") symptoms = gr.Textbox( label="Describe Your Symptoms", lines=4 ) output = gr.Textbox( label="Analysis", lines=12 ) btn = gr.Button("Analyze Symptoms") btn.click( fn=analyze, inputs=symptoms, outputs=output ) demo.launch()