Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import gradio as gr
|
| 3 |
+
from orchestrator import run_patient_risk_analysis
|
| 4 |
+
import json
|
| 5 |
+
|
| 6 |
+
def get_analysis_for_display(patient_id_selection):
|
| 7 |
+
"""
|
| 8 |
+
This function is called by Gradio when the user clicks the button.
|
| 9 |
+
"""
|
| 10 |
+
patient_id = patient_id_selection.split(" ")[0]
|
| 11 |
+
analysis_result = run_patient_risk_analysis(patient_id)
|
| 12 |
+
return analysis_result
|
| 13 |
+
|
| 14 |
+
with gr.Blocks(theme=gr.themes.Soft(), title="Prevently.ai PoC") as app:
|
| 15 |
+
gr.Image("logo.png", show_label=False, show_download_button=False)
|
| 16 |
+
gr.Markdown("# Prevently.ai: 30-Day Readmission Risk PoC")
|
| 17 |
+
gr.Markdown("This Proof-of-Concept demonstrates the core agentic architecture. Select a patient from the dropdown to simulate the workflow.")
|
| 18 |
+
with gr.Row():
|
| 19 |
+
patient_selector = gr.Dropdown(
|
| 20 |
+
label="Select a Mock Patient",
|
| 21 |
+
choices=["P0-12345 (High Risk)", "P1-67890 (Low Risk)"],
|
| 22 |
+
value="P0-12345 (High Risk)"
|
| 23 |
+
)
|
| 24 |
+
submit_button = gr.Button("Run Analysis", variant="primary")
|
| 25 |
+
gr.Markdown("## Risk Analysis Result")
|
| 26 |
+
output_display = gr.JSON(label="AI Service Response")
|
| 27 |
+
submit_button.click(
|
| 28 |
+
fn=get_analysis_for_display,
|
| 29 |
+
inputs=patient_selector,
|
| 30 |
+
outputs=output_display
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
app.launch()
|