faizhalas commited on
Commit
f8bf06d
·
verified ·
1 Parent(s): a6a62cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -56,14 +56,14 @@ if uploaded_file is not None:
56
  elif extype.endswith('.txt'):
57
  data = conv_txt(extype)
58
 
59
- #edited_df = st.data_editor(data)
60
-
61
- columns_to_check = ['Authors', 'Title', 'Source title', 'Author Keywords', 'Keywords Plus']
 
 
 
62
 
63
- for column in columns_to_check:
64
- if column in data.columns:
65
- st.write(f"The column '{column}' exists in the DataFrame.")
66
- else:
67
- st.write(f"The column '{column}' does not exist in the DataFrame.")
68
-
69
- st.write(data)
 
56
  elif extype.endswith('.txt'):
57
  data = conv_txt(extype)
58
 
59
+ #===check keywords===
60
+ @st.cache_data(ttl=3600)
61
+ def get_data(extype):
62
+ list_of_column_key = list(keywords.columns)
63
+ list_of_column_key = [k for k in list_of_column_key if 'Keyword' in k]
64
+ return list_of_column_key
65
 
66
+ if not list_of_column_key:
67
+ st.error('Unfortunately, you don't have a column containing keywords in your data. Please check again. If you want to use it in another column, please rename it to "Keywords".')
68
+ else:
69
+ st.write('✅')