Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,12 +3,13 @@ import pandas as pd
|
|
| 3 |
from sklearn.ensemble import RandomForestClassifier
|
| 4 |
import joblib
|
| 5 |
import gradio as gr
|
|
|
|
| 6 |
|
| 7 |
# Load the trained classifier model
|
| 8 |
model = joblib.load('model_pkl')
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
|
| 13 |
# Function to simulate the medical assistant's interaction
|
| 14 |
def medical_assistant_interaction(pulse_rate, blood_pressure_systolic, blood_pressure_diastolic, temperature_celsius,
|
|
@@ -49,16 +50,15 @@ def medical_assistant_interaction(pulse_rate, blood_pressure_systolic, blood_pre
|
|
| 49 |
|
| 50 |
The patient reported the following symptoms: {patient_responses}.
|
| 51 |
|
| 52 |
-
Based on these
|
| 53 |
"""
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
max_tokens=150
|
| 60 |
)
|
| 61 |
-
assistant_message = response['
|
| 62 |
|
| 63 |
# Combine the assistant's message with the model's prediction
|
| 64 |
if prediction == 1:
|
|
|
|
| 3 |
from sklearn.ensemble import RandomForestClassifier
|
| 4 |
import joblib
|
| 5 |
import gradio as gr
|
| 6 |
+
import google.generativeai as gai
|
| 7 |
|
| 8 |
# Load the trained classifier model
|
| 9 |
model = joblib.load('model_pkl')
|
| 10 |
|
| 11 |
+
|
| 12 |
+
gai.configure(api_key='AIzaSyAwP55Zlq9KqUBjHWWUjfzHcP4Sr8DVMuk')
|
| 13 |
|
| 14 |
# Function to simulate the medical assistant's interaction
|
| 15 |
def medical_assistant_interaction(pulse_rate, blood_pressure_systolic, blood_pressure_diastolic, temperature_celsius,
|
|
|
|
| 50 |
|
| 51 |
The patient reported the following symptoms: {patient_responses}.
|
| 52 |
|
| 53 |
+
Based on these symptoms, what is the likelihood of Lassa fever? Provide additional follow-up questions if necessary.
|
| 54 |
"""
|
| 55 |
|
| 56 |
+
response = gai.chat(
|
| 57 |
+
model="chat-bison-001",
|
| 58 |
+
messages=[{"role": "user", "content": response_text}],
|
| 59 |
+
max_output_tokens=150
|
|
|
|
| 60 |
)
|
| 61 |
+
assistant_message = response.last['content'].strip()
|
| 62 |
|
| 63 |
# Combine the assistant's message with the model's prediction
|
| 64 |
if prediction == 1:
|