File size: 2,926 Bytes
4d349c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# 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)