jfataphd commited on
Commit
e19aaab
1 Parent(s): 4aca736

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -49
app.py CHANGED
@@ -927,72 +927,72 @@ if query:
927
  st.markdown("---")
928
 
929
 
930
- import os
931
 
932
- from datasets import Dataset
933
 
934
- # Check if the comments directory exists
935
- if os.path.exists('comments'):
936
- # Load the dataset from disk
937
- dataset = Dataset.load_from_disk('comments')
938
- else:
939
- # Create a new dataset
940
- dataset = Dataset.from_dict({'id': [], 'text': []})
941
 
942
- def save_comment(comment):
943
- # Check if the dataset exists
944
- if os.path.exists('comments'):
945
- dataset = Dataset.load_from_disk('comments')
946
- else:
947
- dataset = Dataset.from_dict({'id': [], 'text': []})
948
 
949
- # Append the new comment to the dataset
950
- new_comment = {'id': len(dataset), 'text': comment}
951
- dataset = dataset.concatenate(Dataset.from_dict(new_comment))
952
 
953
- # Save the dataset to disk
954
- dataset.save_to_disk('comments')
955
 
956
- print('Comment saved to dataset.')
957
 
958
 
959
 
960
 
961
- st.title("Abstractalytics Web App")
962
- st.write("We appreciate your feedback!")
963
 
964
- user_comment = st.text_area("Please send us your anonymous remarks/suggestions about the Abstractalytics Web App: "
965
- "(app will pause while we save your comments)")
966
 
967
- if st.button("Submit"):
968
- if user_comment:
969
- save_comment(user_comment)
970
- st.success("Your comment has been saved. Thank you for your feedback!")
971
- else:
972
- st.warning("Please enter a comment before submitting.")
973
 
974
- # Load the comments dataset from disk
975
- if os.path.exists('comments'):
976
- dataset = Dataset.load_from_disk('comments')
977
- else:
978
- dataset = Dataset.from_dict({'id': [], 'text': []})
979
 
980
- # Access the text column of the dataset
981
- comments = dataset['text']
982
 
983
- # Define the password
984
- PASSWORD = 'ram100pass'
985
 
986
- # Prompt the user for the password
987
- password = st.text_input('Password:', type='password')
988
 
989
- # Display the comments if the password is correct
990
- if password == PASSWORD:
991
- st.title('Comments')
992
- for comment in comments:
993
- st.write(comment)
994
- else:
995
- st.warning('Incorrect password')
996
 
997
  st.markdown("---")
998
 
 
927
  st.markdown("---")
928
 
929
 
930
+ # import os
931
 
932
+ # from datasets import Dataset
933
 
934
+ # # Check if the comments directory exists
935
+ # if os.path.exists('comments'):
936
+ # # Load the dataset from disk
937
+ # dataset = Dataset.load_from_disk('comments')
938
+ # else:
939
+ # # Create a new dataset
940
+ # dataset = Dataset.from_dict({'id': [], 'text': []})
941
 
942
+ # def save_comment(comment):
943
+ # # Check if the dataset exists
944
+ # if os.path.exists('comments'):
945
+ # dataset = Dataset.load_from_disk('comments')
946
+ # else:
947
+ # dataset = Dataset.from_dict({'id': [], 'text': []})
948
 
949
+ # # Append the new comment to the dataset
950
+ # new_comment = {'id': len(dataset), 'text': comment}
951
+ # dataset = dataset.concatenate(Dataset.from_dict(new_comment))
952
 
953
+ # # Save the dataset to disk
954
+ # dataset.save_to_disk('comments')
955
 
956
+ # print('Comment saved to dataset.')
957
 
958
 
959
 
960
 
961
+ # st.title("Abstractalytics Web App")
962
+ # st.write("We appreciate your feedback!")
963
 
964
+ # user_comment = st.text_area("Please send us your anonymous remarks/suggestions about the Abstractalytics Web App: "
965
+ # "(app will pause while we save your comments)")
966
 
967
+ # if st.button("Submit"):
968
+ # if user_comment:
969
+ # save_comment(user_comment)
970
+ # st.success("Your comment has been saved. Thank you for your feedback!")
971
+ # else:
972
+ # st.warning("Please enter a comment before submitting.")
973
 
974
+ # # Load the comments dataset from disk
975
+ # if os.path.exists('comments'):
976
+ # dataset = Dataset.load_from_disk('comments')
977
+ # else:
978
+ # dataset = Dataset.from_dict({'id': [], 'text': []})
979
 
980
+ # # Access the text column of the dataset
981
+ # comments = dataset['text']
982
 
983
+ # # Define the password
984
+ # PASSWORD = 'ram100pass'
985
 
986
+ # # Prompt the user for the password
987
+ # password = st.text_input('Password:', type='password')
988
 
989
+ # # Display the comments if the password is correct
990
+ # if password == PASSWORD:
991
+ # st.title('Comments')
992
+ # for comment in comments:
993
+ # st.write(comment)
994
+ # else:
995
+ # st.warning('Incorrect password')
996
 
997
  st.markdown("---")
998