jfataphd commited on
Commit
ae598a1
·
1 Parent(s): a5c6e46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -6
app.py CHANGED
@@ -940,14 +940,23 @@ if query:
940
  dataset = Dataset.from_dict({'id': [], 'text': []})
941
 
942
  def save_comment(comment):
943
- # Add the comment to the dataset
944
- dataset['id'].append(len(dataset))
945
- dataset['text'].append(comment)
 
 
 
 
 
 
 
 
 
 
 
946
 
947
- # Save the dataset to disk
948
- dataset.save_to_disk('comments')
949
 
950
- print('Comment saved to dataset.')
951
 
952
  st.title("Abstractalytics Web App")
953
  st.write("We appreciate your feedback!")
 
940
  dataset = Dataset.from_dict({'id': [], 'text': []})
941
 
942
  def save_comment(comment):
943
+ # Check if the comments directory exists
944
+ if os.path.exists('comments'):
945
+ # Load the dataset from disk
946
+ dataset = Dataset.load_from_disk('comments')
947
+ else:
948
+ # Create a new dataset
949
+ dataset = Dataset.from_dict({'id': [], 'text': []})
950
+
951
+ # Add the comment to the dataset
952
+ dataset['id'].append(len(dataset))
953
+ dataset['text'].append(comment)
954
+
955
+ # Save the dataset to disk
956
+ dataset.save_to_disk('comments')
957
 
958
+ print('Comment saved to dataset.')
 
959
 
 
960
 
961
  st.title("Abstractalytics Web App")
962
  st.write("We appreciate your feedback!")