Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -59,10 +59,15 @@ def medical_assistant_interaction(pulse_rate, blood_pressure_systolic, blood_pre
|
|
| 59 |
#max_output_tokens=150
|
| 60 |
)
|
| 61 |
#assistant_message = response.last['content'].strip()
|
| 62 |
-
if 'candidates'
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
else:
|
| 65 |
-
assistant_message = "Error:
|
|
|
|
| 66 |
|
| 67 |
# Combine the assistant's message with the model's prediction
|
| 68 |
if prediction == 1:
|
|
|
|
| 59 |
#max_output_tokens=150
|
| 60 |
)
|
| 61 |
#assistant_message = response.last['content'].strip()
|
| 62 |
+
if hasattr(response, 'candidates'):
|
| 63 |
+
candidates = response.candidates
|
| 64 |
+
if len(candidates) > 0 and hasattr(candidates[0], 'content'):
|
| 65 |
+
assistant_message = candidates[0].content.strip()
|
| 66 |
+
else:
|
| 67 |
+
assistant_message = "Error: No valid response from the model."
|
| 68 |
else:
|
| 69 |
+
assistant_message = "Error: Response object does not have 'candidates' attribute."
|
| 70 |
+
|
| 71 |
|
| 72 |
# Combine the assistant's message with the model's prediction
|
| 73 |
if prediction == 1:
|