Muhammadidrees commited on
Commit
7f605a2
·
verified ·
1 Parent(s): ccc0f9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -12
app.py CHANGED
@@ -20,12 +20,11 @@ def analyze(
20
  except Exception:
21
  bmi = "N/A"
22
 
23
- # System-style instruction (non-medical, fixed headings)
24
  system_prompt = (
25
  """Output MUST strictly follow this structured format:
26
 
27
  1. Executive Summary
28
- - Longevity Vitality Score (out of 100)
29
  - Top Priority Issues
30
  - Key Strengths
31
 
@@ -33,7 +32,7 @@ def analyze(
33
  - Blood Health (MCV, RDW, Lymphocytes, WBC)
34
  - Protein & Liver Health (Albumin, ALP)
35
  - Kidney Health (Creatinine µmol/L)
36
- - Metabolic Health (Glucose mmol/L, lnCRP)
37
  - Other relevant systems
38
 
39
  3. Personalized Action Plan
@@ -44,13 +43,6 @@ def analyze(
44
 
45
  4. Interaction Alerts
46
  - How biomarkers interact (e.g., anemia ↔ infection cycle, ALP with bone/liver origin)
47
-
48
- 5. Longevity Metrics
49
- - Metabolic Health Score
50
- - Cardiovascular & Cognitive risk trajectory
51
-
52
- . Enhanced AI Insights & Longitudinal Risk
53
-
54
  """
55
  )
56
 
@@ -80,7 +72,7 @@ Lab Values:
80
  # Call LLM
81
  result = pipe(
82
  prompt,
83
- max_new_tokens=5000,
84
  do_sample=True,
85
  temperature=0.3,
86
  top_p=0.9,
@@ -95,6 +87,7 @@ Lab Values:
95
 
96
  return output_text
97
 
 
98
  # Build Gradio UI
99
  with gr.Blocks() as demo:
100
  gr.Markdown("## 🧪 Wellness Insights AI — Enter Profile Data")
@@ -127,7 +120,7 @@ with gr.Blocks() as demo:
127
  alp = gr.Number(label="Alkaline Phosphatase (U/L)")
128
 
129
  analyze_btn = gr.Button("🔎 Analyze")
130
- output = gr.Textbox(label="AI Wellness Assessment", lines=12)
131
 
132
  analyze_btn.click(
133
  fn=analyze,
 
20
  except Exception:
21
  bmi = "N/A"
22
 
23
+ # System-style instruction (cleaned: no estimates, no longevity scores)
24
  system_prompt = (
25
  """Output MUST strictly follow this structured format:
26
 
27
  1. Executive Summary
 
28
  - Top Priority Issues
29
  - Key Strengths
30
 
 
32
  - Blood Health (MCV, RDW, Lymphocytes, WBC)
33
  - Protein & Liver Health (Albumin, ALP)
34
  - Kidney Health (Creatinine µmol/L)
35
+ - Metabolic Health (Glucose mmol/L, CRP)
36
  - Other relevant systems
37
 
38
  3. Personalized Action Plan
 
43
 
44
  4. Interaction Alerts
45
  - How biomarkers interact (e.g., anemia ↔ infection cycle, ALP with bone/liver origin)
 
 
 
 
 
 
 
46
  """
47
  )
48
 
 
72
  # Call LLM
73
  result = pipe(
74
  prompt,
75
+ max_new_tokens=1000,
76
  do_sample=True,
77
  temperature=0.3,
78
  top_p=0.9,
 
87
 
88
  return output_text
89
 
90
+
91
  # Build Gradio UI
92
  with gr.Blocks() as demo:
93
  gr.Markdown("## 🧪 Wellness Insights AI — Enter Profile Data")
 
120
  alp = gr.Number(label="Alkaline Phosphatase (U/L)")
121
 
122
  analyze_btn = gr.Button("🔎 Analyze")
123
+ output = gr.Textbox(label="AI Lab Report (No Predictions)", lines=12)
124
 
125
  analyze_btn.click(
126
  fn=analyze,