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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -48
app.py CHANGED
@@ -927,68 +927,63 @@ 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
- # 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!")
954
 
955
- user_comment = st.text_area("Please send us your anonymous remarks/suggestions about the Abstractalytics Web App: "
956
  "(app will pause while we save your comments)")
957
 
958
- if st.button("Submit"):
959
- if user_comment:
960
- save_comment(user_comment)
961
- st.success("Your comment has been saved. Thank you for your feedback!")
962
- else:
963
- st.warning("Please enter a comment before submitting.")
964
-
965
- # Load the comments dataset from disk
966
- if os.path.exists('comments'):
967
- dataset = Dataset.load_from_disk('comments')
968
- else:
969
- dataset = Dataset.from_dict({'id': [], 'text': []})
970
-
971
- # Access the text column of the dataset
972
- comments = dataset['text']
973
 
974
- # Define the password
975
- PASSWORD = 'ram100pass'
976
-
977
- # Create a Streamlit app
978
- st.set_page_config(page_title='Comments')
979
 
980
- # Prompt the user for the password
981
- password = st.text_input('Password:', type='password')
982
 
983
- # Display the comments if the password is correct
984
- if password == PASSWORD:
985
- st.title('Comments')
986
- for comment in comments:
987
- st.write(comment)
988
- else:
989
- st.warning('Incorrect password')
990
 
 
 
991
 
 
 
 
 
 
 
 
992
 
993
  st.markdown("---")
994
 
 
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
+ # 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!")
954
 
955
+ user_comment = st.text_area("Please send us your anonymous remarks/suggestions about the Abstractalytics Web App: "
956
  "(app will pause while we save your comments)")
957
 
958
+ if st.button("Submit"):
959
+ if user_comment:
960
+ save_comment(user_comment)
961
+ st.success("Your comment has been saved. Thank you for your feedback!")
962
+ else:
963
+ st.warning("Please enter a comment before submitting.")
 
 
 
 
 
 
 
 
 
964
 
965
+ # Load the comments dataset from disk
966
+ if os.path.exists('comments'):
967
+ dataset = Dataset.load_from_disk('comments')
968
+ else:
969
+ dataset = Dataset.from_dict({'id': [], 'text': []})
970
 
971
+ # Access the text column of the dataset
972
+ comments = dataset['text']
973
 
974
+ # Define the password
975
+ PASSWORD = 'ram100pass'
 
 
 
 
 
976
 
977
+ # Prompt the user for the password
978
+ password = st.text_input('Password:', type='password')
979
 
980
+ # Display the comments if the password is correct
981
+ if password == PASSWORD:
982
+ st.title('Comments')
983
+ for comment in comments:
984
+ st.write(comment)
985
+ else:
986
+ st.warning('Incorrect password')
987
 
988
  st.markdown("---")
989