Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import json
|
| 3 |
import os
|
|
@@ -8,7 +50,7 @@ def load_feedback(filename):
|
|
| 8 |
with open(filename, 'r') as file:
|
| 9 |
return json.load(file)
|
| 10 |
else:
|
| 11 |
-
return {'thumbs_up': 0, 'thumbs_down': 0}
|
| 12 |
|
| 13 |
# Function to save feedback to a JSON file
|
| 14 |
def save_feedback(feedback, filename):
|
|
@@ -32,7 +74,18 @@ if st.button("π Thumbs Down"):
|
|
| 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 |
# Display current feedback
|
| 36 |
-
st.
|
| 37 |
st.write(f"π Thumbs Up: {feedback['thumbs_up']}")
|
| 38 |
st.write(f"π Thumbs Down: {feedback['thumbs_down']}")
|
|
|
|
|
|
|
|
|
|
|
|
| 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}
|
| 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 |
+
# # Display current feedback
|
| 36 |
+
# st.write("Current Feedback:")
|
| 37 |
+
# st.write(f"π Thumbs Up: {feedback['thumbs_up']}")
|
| 38 |
+
# st.write(f"π Thumbs Down: {feedback['thumbs_down']}")
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
|
| 43 |
import streamlit as st
|
| 44 |
import json
|
| 45 |
import os
|
|
|
|
| 50 |
with open(filename, 'r') as file:
|
| 51 |
return json.load(file)
|
| 52 |
else:
|
| 53 |
+
return {'thumbs_up': 0, 'thumbs_down': 0, 'comments': []}
|
| 54 |
|
| 55 |
# Function to save feedback to a JSON file
|
| 56 |
def save_feedback(feedback, filename):
|
|
|
|
| 74 |
save_feedback(feedback, feedback_filename)
|
| 75 |
st.error("We're sorry to hear that. Please reach out to us for further assistance.")
|
| 76 |
|
| 77 |
+
# Comments section
|
| 78 |
+
st.header("Comments")
|
| 79 |
+
comment = st.text_area("Leave your comment here:")
|
| 80 |
+
if st.button("Submit Comment"):
|
| 81 |
+
feedback['comments'].append(comment)
|
| 82 |
+
save_feedback(feedback, feedback_filename)
|
| 83 |
+
st.success("Your comment has been submitted!")
|
| 84 |
+
|
| 85 |
# Display current feedback
|
| 86 |
+
st.header("Current Feedback:")
|
| 87 |
st.write(f"π Thumbs Up: {feedback['thumbs_up']}")
|
| 88 |
st.write(f"π Thumbs Down: {feedback['thumbs_down']}")
|
| 89 |
+
st.write("Comments:")
|
| 90 |
+
for c in feedback['comments']:
|
| 91 |
+
st.write(c)
|