Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -75,4 +75,27 @@ def main():
|
|
| 75 |
|
| 76 |
# Map emotion label from the model to our suggestion database
|
| 77 |
if emotion == "LABEL_0":
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
# Map emotion label from the model to our suggestion database
|
| 77 |
if emotion == "LABEL_0":
|
| 78 |
+
emotion = "NEGATIVE"
|
| 79 |
+
elif emotion == "LABEL_1":
|
| 80 |
+
emotion = "POSITIVE"
|
| 81 |
+
else:
|
| 82 |
+
emotion = "NEUTRAL"
|
| 83 |
+
|
| 84 |
+
st.write(f"Emotion detected: {emotion}")
|
| 85 |
+
|
| 86 |
+
# Step 3: Suggest activities, articles, and videos
|
| 87 |
+
resources = suggest_activity({emotion: 1})
|
| 88 |
+
st.write("Suggestions:")
|
| 89 |
+
for suggestion in resources["suggestions"]:
|
| 90 |
+
st.write(f"- {suggestion}")
|
| 91 |
+
|
| 92 |
+
st.write("Articles:")
|
| 93 |
+
for article in resources["articles"]:
|
| 94 |
+
st.write(f"- [{article['title']}]({article['url']})")
|
| 95 |
+
|
| 96 |
+
st.write("Videos:")
|
| 97 |
+
for video in resources["videos"]:
|
| 98 |
+
st.write(f"- [{video['title']}]({video['url']})")
|
| 99 |
+
|
| 100 |
+
if __name__ == "__main__":
|
| 101 |
+
main()
|