# app.py """ The main Gradio user interface for Project Asclepius. This file defines the layout and connects UI components to the backend logic. """ import gradio as gr from modules import orchestrator # --- UI Layout and Components --- # Load custom CSS for a polished look with open("static/style.css", "r", encoding="utf-8") as f: custom_css = f.read() # Define the main application blocks with gr.Blocks(theme=gr.themes.Soft(), css=custom_css) as demo: # Header with gr.Row(): # You can add your own logo.png to the static folder # gr.Image("static/logo.png", width=100, show_label=False, show_download_button=False) gr.Markdown("# 🧠 Project Asclepius: The Cognitive Medical Nexus") gr.Markdown("An AI-powered system that synthesizes public medical data to provide clear, evidence-based information. **This is not a diagnostic tool.**") # Define the main tabs for different functionalities with gr.Tabs(): # --- TAB 1: Symptom Synthesizer --- with gr.TabItem("Symptom Synthesizer"): with gr.Row(): with gr.Column(scale=2): symptom_input = gr.Textbox( lines=5, label="Describe Symptoms or Ask a Medical Question", placeholder="e.g., 'I have a sharp pain in my chest and feel dizzy' or 'What are the latest treatments for migraines?'" ) # Optional image input can be added here # image_input = gr.Image(type="pil", label="Upload a relevant image (e.g., skin rash)", optional=True) with gr.Column(scale=1): submit_btn = gr.Button("Synthesize Information", variant="primary") gr.Markdown("---") synthesis_output = gr.Markdown(label="Synthesized Report") # --- TAB 2: Research Deep Dive (Placeholder) --- with gr.TabItem("Research Deep Dive"): gr.Markdown("## Feature Coming Soon\nThis section will allow you to do a deep dive on a specific disease, gene, or drug, pulling in comprehensive research data.") # Add inputs and outputs for this tab here # --- TAB 3: Drug Interaction Analyzer (Placeholder) --- with gr.TabItem("Drug Interaction Analyzer"): gr.Markdown("## Feature Coming Soon\nThis tool will analyze potential interactions and safety concerns for a list of medications.") # Add inputs and outputs for this tab here # --- Event Handlers --- submit_btn.click( fn=orchestrator.run_symptom_synthesis, inputs=[symptom_input], # Add image_input here if using outputs=[synthesis_output], api_name="symptom_synthesis", show_progress="full" # Provides a great user experience ) # Launch the application if __name__ == "__main__": demo.launch(debug=True)