Muhammadidrees commited on
Commit
e58133f
verified
1 Parent(s): 9ebeb3d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +50 -32
app.py CHANGED
@@ -86,41 +86,59 @@ def respond(albumin, creatinine, glucose, crp, mcv, rdw, alp, wbc, lymphocytes,
86
  return completion.choices[0].message.content
87
 
88
 
89
- # ---------------- Gradio UI ----------------
90
- with gr.Blocks() as demo:
91
- gr.Markdown("## 馃И AI Health Assistant (Extended Biomarkers via Groq Llama-3.3-70B)")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
 
93
  with gr.Row():
94
- with gr.Column():
95
- albumin = gr.Textbox(label="Albumin (g/dL)", value="4.5")
96
- creatinine = gr.Textbox(label="Creatinine (mg/dL)", value="1.5")
97
- glucose = gr.Textbox(label="Glucose (mg/dL, fasting)", value="160")
98
- crp = gr.Textbox(label="CRP (mg/L)", value="2.5")
99
- mcv = gr.Textbox(label="MCV (fL)", value="150")
100
- rdw = gr.Textbox(label="RDW (%)", value="15")
101
- alp = gr.Textbox(label="ALP (U/L)", value="146")
102
- wbc = gr.Textbox(label="WBC (10^3/渭L)", value="10.5")
103
- lymphocytes = gr.Textbox(label="Lymphocytes (%)", value="38")
104
- hemoglobin = gr.Textbox(label="Hemoglobin (g/dL)", value="13.5")
105
- pv = gr.Textbox(label="Plasma Viscosity (mPa路s)", value="1.7")
106
-
107
- with gr.Column():
108
- age = gr.Textbox(label="Age (years)", value="30")
109
- gender = gr.Dropdown(choices=["Male", "Female"], label="Gender", value="Male")
110
- height = gr.Textbox(label="Height (cm)", value="170")
111
- weight = gr.Textbox(label="Weight (kg)", value="65")
112
-
113
- output = gr.Textbox(label="AI Health Report", lines=30)
114
-
115
- btn = gr.Button("Generate Report")
116
- btn.click(
117
- respond,
118
  inputs=[
119
- albumin, creatinine, glucose, crp, mcv, rdw, alp, wbc,
120
- lymphocytes, hemoglobin, pv, age, gender, height, weight
 
121
  ],
122
- outputs=output
123
  )
124
 
125
- if __name__ == "__main__":
126
- demo.launch()
 
86
  return completion.choices[0].message.content
87
 
88
 
89
+ # --- Gradio Interface ---
90
+ with gr.Blocks(title="馃К Biomarker Medical Insight Chatbot") as demo:
91
+ gr.Markdown(
92
+ """
93
+ ## 馃 AI-Powered Biomarker Report Generator
94
+ Enter the patient details and biomarkers below.
95
+ The AI will generate a **comprehensive medical report** with structured insights, risk assessment, and recommendations.
96
+ """
97
+ )
98
+
99
+ # --- Basic Info ---
100
+ with gr.Row():
101
+ age = gr.Number(label="Age", value=45)
102
+ gender = gr.Radio(["Male", "Female"], label="Gender", value="Male")
103
+
104
+ with gr.Row():
105
+ height = gr.Number(label="Height (cm)", value=175)
106
+ weight = gr.Number(label="Weight (kg)", value=72)
107
+
108
+ # --- Biomarkers ---
109
+ gr.Markdown("### 馃Й Biomarker Inputs (Demo Values Pre-filled)")
110
+ with gr.Row():
111
+ albumin = gr.Number(label="Albumin (g/dL)", value=4.2)
112
+ creatinine = gr.Number(label="Creatinine (mg/dL)", value=1.1)
113
+ glucose = gr.Number(label="Glucose (mg/dL)", value=98)
114
 
115
  with gr.Row():
116
+ crp = gr.Number(label="CRP (mg/L)", value=2.5)
117
+ mcv = gr.Number(label="MCV (fL)", value=90.5)
118
+ rdw = gr.Number(label="RDW (%)", value=13.2)
119
+
120
+ with gr.Row():
121
+ alp = gr.Number(label="ALP (U/L)", value=110)
122
+ wbc = gr.Number(label="WBC (x10^3/渭L)", value=6.8)
123
+ lymphocytes = gr.Number(label="Lymphocytes (%)", value=35)
124
+
125
+ with gr.Row():
126
+ hb = gr.Number(label="Hemoglobin (g/dL)", value=14.5)
127
+ pv = gr.Number(label="Plasma (PV) (mL)", value=3000)
128
+
129
+ # --- Submit + Output ---
130
+ submit_btn = gr.Button("馃摛 Generate Medical Report")
131
+ output_box = gr.HTML(label="馃 AI-Generated Medical Report (Rendered in Markup)")
132
+
133
+ submit_btn.click(
134
+ generate_report,
 
 
 
 
 
135
  inputs=[
136
+ age, gender, height, weight,
137
+ albumin, creatinine, glucose, crp, mcv,
138
+ rdw, alp, wbc, lymphocytes, hb, pv
139
  ],
140
+ outputs=output_box
141
  )
142
 
143
+ demo.launch()
144
+