tarrasyed19472007 commited on
Commit
9f5d8a9
·
verified ·
1 Parent(s): 5a49ede

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -9
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import streamlit as st
2
  from transformers import pipeline
3
  import torch
 
4
 
5
  # ---- Page Configuration ----
6
  st.set_page_config(
@@ -103,15 +104,30 @@ for i, question in enumerate(questions, start=1):
103
  # ---- Display Results ----
104
  if st.button("Submit Responses"):
105
  st.write("### 📊 Emotion Analysis Results")
106
- if responses:
107
- for i, (question, details) in enumerate(responses.items(), start=1):
108
- st.write(f"#### Question {i}: {question}")
109
- st.write(f"**Your Response:** {details['Response']}")
110
- st.write(f"**Emotion Analysis:** {details['Analysis']}")
111
- activity_suggestion = suggest_activity(details["Analysis"])
112
- st.write(f"**Suggested Activity:** {activity_suggestion}")
113
- else:
114
- st.warning("Please answer at least one question before submitting!")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
 
116
  # ---- Footer ----
117
  st.markdown(
 
1
  import streamlit as st
2
  from transformers import pipeline
3
  import torch
4
+ import pandas as pd
5
 
6
  # ---- Page Configuration ----
7
  st.set_page_config(
 
104
  # ---- Display Results ----
105
  if st.button("Submit Responses"):
106
  st.write("### 📊 Emotion Analysis Results")
107
+
108
+ # Prepare the data for the summary table
109
+ summary_data = []
110
+ for i, (question, details) in enumerate(responses.items(), start=1):
111
+ # Activity suggestion for each response
112
+ activity_suggestion = suggest_activity(details["Analysis"])
113
+
114
+ # Add data to the summary list
115
+ summary_data.append({
116
+ "Question": question,
117
+ "Your Response": details["Response"],
118
+ "Emotion Analysis": details["Analysis"],
119
+ "Suggested Activity": activity_suggestion
120
+ })
121
+
122
+ # Create a DataFrame from the summary data
123
+ df = pd.DataFrame(summary_data)
124
+
125
+ # Display the summary table
126
+ st.dataframe(df) # or use st.table(df) for a static table
127
+
128
+ # Provide additional suggestions at the end of all questions
129
+ st.write("### 🌟 Final Suggestions")
130
+ st.write("It’s great that you're exploring your emotions! Regular mindfulness practices, deep breathing exercises, and physical activities like walking can help keep your emotions in balance and improve overall well-being. 🌱")
131
 
132
  # ---- Footer ----
133
  st.markdown(