Srinivas T B
commited on
adsa
Browse files
app.py
CHANGED
@@ -23,10 +23,13 @@ st.markdown(
|
|
23 |
)
|
24 |
|
25 |
def map_to_emotion(spo2, bp, temp):
|
|
|
|
|
|
|
26 |
# Spo2 mapping
|
27 |
-
if
|
28 |
spo2_emotion = ["Joy", "Anticipation", "Trust"]
|
29 |
-
elif
|
30 |
spo2_emotion = ["Fear"]
|
31 |
else:
|
32 |
spo2_emotion = ["Anger", "Disgust"]
|
@@ -40,9 +43,9 @@ def map_to_emotion(spo2, bp, temp):
|
|
40 |
bp_emotion = ["Surprise"]
|
41 |
|
42 |
# Temperature mapping
|
43 |
-
if temp >= 98.
|
44 |
temp_emotion = ["Joy", "Surprise", "Disgust", "Anticipation"]
|
45 |
-
elif temp < 98.
|
46 |
temp_emotion = ["Sadness"]
|
47 |
else:
|
48 |
temp_emotion = ["Fear", "Anger"]
|
@@ -51,6 +54,7 @@ def map_to_emotion(spo2, bp, temp):
|
|
51 |
emotions = spo2_emotion + bp_emotion + temp_emotion
|
52 |
return emotions
|
53 |
|
|
|
54 |
def predict_levels(emotions):
|
55 |
# Placeholder for machine learning models
|
56 |
# Here, we generate random predictions as placeholders
|
|
|
23 |
)
|
24 |
|
25 |
def map_to_emotion(spo2, bp, temp):
|
26 |
+
# Convert spo2 to numeric type
|
27 |
+
spo2_numeric = float(spo2.split('%')[0])
|
28 |
+
|
29 |
# Spo2 mapping
|
30 |
+
if spo2_numeric >= 96:
|
31 |
spo2_emotion = ["Joy", "Anticipation", "Trust"]
|
32 |
+
elif spo2_numeric == 93 or spo2_numeric == 94:
|
33 |
spo2_emotion = ["Fear"]
|
34 |
else:
|
35 |
spo2_emotion = ["Anger", "Disgust"]
|
|
|
43 |
bp_emotion = ["Surprise"]
|
44 |
|
45 |
# Temperature mapping
|
46 |
+
if temp >= "98.7F" and temp <= "99.1F":
|
47 |
temp_emotion = ["Joy", "Surprise", "Disgust", "Anticipation"]
|
48 |
+
elif temp < "98.7F":
|
49 |
temp_emotion = ["Sadness"]
|
50 |
else:
|
51 |
temp_emotion = ["Fear", "Anger"]
|
|
|
54 |
emotions = spo2_emotion + bp_emotion + temp_emotion
|
55 |
return emotions
|
56 |
|
57 |
+
|
58 |
def predict_levels(emotions):
|
59 |
# Placeholder for machine learning models
|
60 |
# Here, we generate random predictions as placeholders
|