Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,38 +26,8 @@ def analyze(
|
|
| 26 |
"You are an advanced AI medical assistant. "
|
| 27 |
"Analyze the patient’s biomarkers and demographics. "
|
| 28 |
"Provide a structured assessment including: "
|
| 29 |
-
"""
|
| 30 |
-
|
| 31 |
-
- Top Priority Issues
|
| 32 |
-
- Key Strengths
|
| 33 |
-
|
| 34 |
-
2. System-Specific Analysis
|
| 35 |
-
- Blood Health (MCV, RDW, Lymphocytes, WBC)
|
| 36 |
-
- Protein & Liver Health (Albumin, ALP)
|
| 37 |
-
- Kidney Health (Creatinine µmol/L)
|
| 38 |
-
- Metabolic Health (Glucose mmol/L, lnCRP)
|
| 39 |
-
- Other relevant systems
|
| 40 |
-
|
| 41 |
-
3. Personalized Action Plan
|
| 42 |
-
- Medical (tests/consults)
|
| 43 |
-
- Nutrition (diet & supplements)
|
| 44 |
-
- Lifestyle (hydration, exercise, sleep)
|
| 45 |
-
- Testing (follow-up labs: ferritin, Vitamin D, GGT)
|
| 46 |
-
|
| 47 |
-
4. Interaction Alerts
|
| 48 |
-
- How biomarkers interact (e.g., anemia ↔ infection cycle, ALP with bone/liver origin)
|
| 49 |
-
|
| 50 |
-
5. Longevity Metrics
|
| 51 |
-
- Metabolic Health Score
|
| 52 |
-
- Cardiovascular & Cognitive risk trajectory
|
| 53 |
-
|
| 54 |
-
6. Tabular Mapping (Biomarker → Value → Status → AI-Inferred Insight → Client-Friendly Message)
|
| 55 |
-
|
| 56 |
-
7. Enhanced AI Insights & Longitudinal Risk
|
| 57 |
-
- Subclinical nutrient predictions (Iron, B12, Folate, Copper)
|
| 58 |
-
- Elevated ALP interpretation (bone vs liver origin)
|
| 59 |
-
- WBC & lymphocyte trends for immunity
|
| 60 |
-
- Predictive longevity risk profile
|
| 61 |
""" )
|
| 62 |
|
| 63 |
# Construct patient profile input
|
|
@@ -86,7 +56,7 @@ def analyze(
|
|
| 86 |
# Call LLM (exclude echoed input)
|
| 87 |
result = pipe(
|
| 88 |
prompt,
|
| 89 |
-
max_new_tokens=
|
| 90 |
do_sample=True,
|
| 91 |
temperature=0.6,
|
| 92 |
return_full_text=False
|
|
|
|
| 26 |
"You are an advanced AI medical assistant. "
|
| 27 |
"Analyze the patient’s biomarkers and demographics. "
|
| 28 |
"Provide a structured assessment including: "
|
| 29 |
+
"""Executive Summary,System-Specific Analysis,Personalized Action Plan,Interaction Alerts,Longevity Metrics,Enhanced AI Insights & Longitudinal Risk
|
| 30 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
""" )
|
| 32 |
|
| 33 |
# Construct patient profile input
|
|
|
|
| 56 |
# Call LLM (exclude echoed input)
|
| 57 |
result = pipe(
|
| 58 |
prompt,
|
| 59 |
+
max_new_tokens=2000,
|
| 60 |
do_sample=True,
|
| 61 |
temperature=0.6,
|
| 62 |
return_full_text=False
|