Update app.py
Browse files
app.py
CHANGED
@@ -46,7 +46,7 @@ except ImportError:
|
|
46 |
if GEMINI_AVAILABLE and os.getenv("GOOGLE_API_KEY"):
|
47 |
try:
|
48 |
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
49 |
-
gemini_model = genai.GenerativeModel('gemini-
|
50 |
except Exception as e:
|
51 |
print(f"Warning: Failed to initialize Gemini: {e}")
|
52 |
GEMINI_AVAILABLE = False
|
@@ -386,30 +386,30 @@ Please install google-generativeai and configure GOOGLE_API_KEY for full AI feat
|
|
386 |
|
387 |
# Prepare enhanced prompt with nutrition requirements
|
388 |
prompt = f"""
|
389 |
-
As a comprehensive medical AI, provide a detailed professional medical assessment based on the following patient data
|
390 |
Format your response with clear headings and professional medical language:
|
391 |
|
392 |
-
PATIENT DEMOGRAPHICS:
|
393 |
-
|
394 |
-
- Age
|
395 |
-
- Sex
|
396 |
-
- Weight
|
397 |
-
- Height
|
398 |
- {bmi_calculation}
|
399 |
|
400 |
-
CHIEF COMPLAINT:
|
401 |
{patient_info.get('complaint', 'Not provided')}
|
402 |
|
403 |
-
MEDICAL HISTORY:
|
404 |
{patient_info.get('medical_history', 'Not provided')}
|
405 |
|
406 |
-
PHYSICAL EXAMINATION:
|
407 |
{patient_info.get('examination', 'Not provided')}
|
408 |
|
409 |
-
HEART SOUNDS ANALYSIS:
|
410 |
{patient_info.get('heartbeat_analysis', 'Not performed')}
|
411 |
|
412 |
-
INVESTIGATIONS:
|
413 |
{patient_info.get('investigation_analysis', 'Not provided')}
|
414 |
|
415 |
Please provide a comprehensive medical assessment with the following structure:
|
@@ -419,7 +419,7 @@ Please install google-generativeai and configure GOOGLE_API_KEY for full AI feat
|
|
419 |
3. **RISK FACTORS ASSESSMENT** - Identify relevant risk factors
|
420 |
4. **RECOMMENDED TREATMENT PLAN** - Detailed treatment approach
|
421 |
5. **FOLLOW-UP RECOMMENDATIONS** - Specific follow-up plans
|
422 |
-
6. **NUTRITIONAL MANAGEMENT PLAN** -
|
423 |
- Patient's current condition
|
424 |
- Age and sex-specific requirements
|
425 |
- Weight management if needed
|
|
|
46 |
if GEMINI_AVAILABLE and os.getenv("GOOGLE_API_KEY"):
|
47 |
try:
|
48 |
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
49 |
+
gemini_model = genai.GenerativeModel('gemini-2.0-flash')
|
50 |
except Exception as e:
|
51 |
print(f"Warning: Failed to initialize Gemini: {e}")
|
52 |
GEMINI_AVAILABLE = False
|
|
|
386 |
|
387 |
# Prepare enhanced prompt with nutrition requirements
|
388 |
prompt = f"""
|
389 |
+
**As a comprehensive medical AI, provide a detailed professional medical assessment based on the following patient data**
|
390 |
Format your response with clear headings and professional medical language:
|
391 |
|
392 |
+
## PATIENT DEMOGRAPHICS:
|
393 |
+
-**Name:** {patient_info.get('name', 'Not provided')}
|
394 |
+
- **Age:** {patient_info.get('age', 'Not provided')} years
|
395 |
+
- **Sex:** {patient_info.get('sex', 'Not provided')}
|
396 |
+
- **Weight:** {patient_info.get('weight', 'Not provided')} kg
|
397 |
+
- **Height:** {patient_info.get('height', 'Not provided')} cm
|
398 |
- {bmi_calculation}
|
399 |
|
400 |
+
## CHIEF COMPLAINT:
|
401 |
{patient_info.get('complaint', 'Not provided')}
|
402 |
|
403 |
+
## MEDICAL HISTORY:
|
404 |
{patient_info.get('medical_history', 'Not provided')}
|
405 |
|
406 |
+
## PHYSICAL EXAMINATION:
|
407 |
{patient_info.get('examination', 'Not provided')}
|
408 |
|
409 |
+
## HEART SOUNDS ANALYSIS:
|
410 |
{patient_info.get('heartbeat_analysis', 'Not performed')}
|
411 |
|
412 |
+
## INVESTIGATIONS:
|
413 |
{patient_info.get('investigation_analysis', 'Not provided')}
|
414 |
|
415 |
Please provide a comprehensive medical assessment with the following structure:
|
|
|
419 |
3. **RISK FACTORS ASSESSMENT** - Identify relevant risk factors
|
420 |
4. **RECOMMENDED TREATMENT PLAN** - Detailed treatment approach
|
421 |
5. **FOLLOW-UP RECOMMENDATIONS** - Specific follow-up plans
|
422 |
+
6. **NUTRITIONAL MANAGEMENT PLAN** - summerized nutrition recommendations based on:
|
423 |
- Patient's current condition
|
424 |
- Age and sex-specific requirements
|
425 |
- Weight management if needed
|