Spaces:
Build error

YashB1 commited on
Commit
081b15e
·
verified ·
1 Parent(s): af0fb50

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -44,14 +44,15 @@ import streamlit as st
44
  import json
45
  import os
46
 
47
- # Function to load existing feedback from a JSON file
48
  def load_feedback(filename):
49
- if os.path.exists(filename):
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):
57
  with open(filename, 'w') as file:
 
44
  import json
45
  import os
46
 
47
+
48
  def load_feedback(filename):
49
+ if os.path.exists(filename) and os.stat(filename).st_size > 0: # Check if file exists and is not empty
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
+
56
  # Function to save feedback to a JSON file
57
  def save_feedback(feedback, filename):
58
  with open(filename, 'w') as file: