Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -50,18 +50,17 @@ def load_feedback(filename):
|
|
| 50 |
return {'thumbs_up': 0, 'thumbs_down': 0, 'comments': []}
|
| 51 |
|
| 52 |
def save_feedback(feedback, filename):
|
|
|
|
|
|
|
| 53 |
with open(filename, 'w') as file:
|
| 54 |
json.dump(feedback, file)
|
| 55 |
|
| 56 |
-
#
|
| 57 |
-
# Set the directory path within your Hugging Face Space
|
| 58 |
-
# Example: "/mnt/data/feedback.json"
|
| 59 |
space_name = "Checking_Feedbacks"
|
| 60 |
|
| 61 |
# Set the directory path within your Hugging Face Space
|
| 62 |
feedback_filename = f"/mnt/{space_name}/feedback.json"
|
| 63 |
|
| 64 |
-
|
| 65 |
# Load existing feedback
|
| 66 |
feedback = load_feedback(feedback_filename)
|
| 67 |
|
|
|
|
| 50 |
return {'thumbs_up': 0, 'thumbs_down': 0, 'comments': []}
|
| 51 |
|
| 52 |
def save_feedback(feedback, filename):
|
| 53 |
+
# Ensure that the directory exists
|
| 54 |
+
os.makedirs(os.path.dirname(filename), exist_ok=True)
|
| 55 |
with open(filename, 'w') as file:
|
| 56 |
json.dump(feedback, file)
|
| 57 |
|
| 58 |
+
# Name of the Hugging Face Space
|
|
|
|
|
|
|
| 59 |
space_name = "Checking_Feedbacks"
|
| 60 |
|
| 61 |
# Set the directory path within your Hugging Face Space
|
| 62 |
feedback_filename = f"/mnt/{space_name}/feedback.json"
|
| 63 |
|
|
|
|
| 64 |
# Load existing feedback
|
| 65 |
feedback = load_feedback(feedback_filename)
|
| 66 |
|