YashB1 commited on
Commit
4e3fab7
Β·
verified Β·
1 Parent(s): 0f809db

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +65 -48
app.py CHANGED
@@ -1,49 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
- import json
3
- import os
4
-
5
- # Function to load existing feedback from a JSON file
6
- def load_feedback(filename):
7
- if os.path.exists(filename):
8
- with open(filename, 'r') as file:
9
- return json.load(file)
10
- else:
11
- return {'thumbs_up': 0, 'thumbs_down': 0, 'comments': []}
12
-
13
- # Function to save feedback to a JSON file
14
- def save_feedback(feedback, filename):
15
- with open(filename, 'w') as file:
16
- json.dump(feedback, file)
17
-
18
- # File to store feedback
19
- feedback_filename = "feedback.json"
20
-
21
- # Load existing feedback
22
- feedback = load_feedback(feedback_filename)
23
-
24
- # Display thumbs up/down buttons
25
- if st.button("πŸ‘ Thumbs Up"):
26
- feedback['thumbs_up'] += 1
27
- save_feedback(feedback, feedback_filename)
28
- st.success("Thanks for your feedback!")
29
-
30
- if st.button("πŸ‘Ž Thumbs Down"):
31
- feedback['thumbs_down'] += 1
32
- save_feedback(feedback, feedback_filename)
33
- st.error("We're sorry to hear that. Please reach out to us for further assistance.")
34
-
35
- # Comments section
36
- st.header("Comments")
37
- comment = st.text_area("Leave your comment here:")
38
- if st.button("Submit Comment"):
39
- feedback['comments'].append(comment)
40
- save_feedback(feedback, feedback_filename)
41
- st.success("Your comment has been submitted!")
42
-
43
- # Display current feedback
44
- st.write("Current Feedback:")
45
- st.write(f"πŸ‘ Thumbs Up: {feedback['thumbs_up']}")
46
- st.write(f"πŸ‘Ž Thumbs Down: {feedback['thumbs_down']}")
47
- st.write("Comments:")
48
- for c in feedback['comments']:
49
- st.write(c)
 
1
+ # import streamlit as st
2
+ # import json
3
+ # import os
4
+
5
+ # # Function to load existing feedback from a JSON file
6
+ # def load_feedback(filename):
7
+ # if os.path.exists(filename):
8
+ # with open(filename, 'r') as file:
9
+ # return json.load(file)
10
+ # else:
11
+ # return {'thumbs_up': 0, 'thumbs_down': 0, 'comments': []}
12
+
13
+ # # Function to save feedback to a JSON file
14
+ # def save_feedback(feedback, filename):
15
+ # with open(filename, 'w') as file:
16
+ # json.dump(feedback, file)
17
+
18
+ # # File to store feedback
19
+ # feedback_filename = "feedback.json"
20
+
21
+ # # Load existing feedback
22
+ # feedback = load_feedback(feedback_filename)
23
+
24
+ # # Display thumbs up/down buttons
25
+ # if st.button("πŸ‘ Thumbs Up"):
26
+ # feedback['thumbs_up'] += 1
27
+ # save_feedback(feedback, feedback_filename)
28
+ # st.success("Thanks for your feedback!")
29
+
30
+ # if st.button("πŸ‘Ž Thumbs Down"):
31
+ # feedback['thumbs_down'] += 1
32
+ # save_feedback(feedback, feedback_filename)
33
+ # st.error("We're sorry to hear that. Please reach out to us for further assistance.")
34
+
35
+ # # Comments section
36
+ # st.header("Comments")
37
+ # comment = st.text_area("Leave your comment here:")
38
+ # if st.button("Submit Comment"):
39
+ # feedback['comments'].append(comment)
40
+ # save_feedback(feedback, feedback_filename)
41
+ # st.success("Your comment has been submitted!")
42
+
43
+ # # Display current feedback
44
+ # st.write("Current Feedback:")
45
+ # st.write(f"πŸ‘ Thumbs Up: {feedback['thumbs_up']}")
46
+ # st.write(f"πŸ‘Ž Thumbs Down: {feedback['thumbs_down']}")
47
+ # st.write("Comments:")
48
+ # for c in feedback['comments']:
49
+ # st.write(c)
50
+
51
+
52
  import streamlit as st
53
+
54
+ def collect_feedback():
55
+ st.title("Feedback Collection App")
56
+
57
+ # Display thumbs up/down buttons for feedback
58
+ feedback = st.radio("Was this helpful?", ('πŸ‘', 'πŸ‘Ž'))
59
+
60
+ if feedback == 'πŸ‘':
61
+ st.success("Thank you for your positive feedback!")
62
+ elif feedback == 'πŸ‘Ž':
63
+ st.error("We're sorry to hear that. Please let us know how we can improve.")
64
+
65
+ if __name__ == "__main__":
66
+ collect_feedback()