Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -59,17 +59,39 @@ if uploaded_file is not None:
|
|
| 59 |
#===check keywords===
|
| 60 |
@st.cache_data(ttl=3600)
|
| 61 |
def get_data(extype):
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
return
|
| 65 |
|
| 66 |
-
|
| 67 |
|
| 68 |
-
if not
|
| 69 |
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'.")
|
| 70 |
else:
|
| 71 |
-
st.write('✅')
|
| 72 |
|
| 73 |
#===check any obj===
|
| 74 |
coldf = sorted(data.select_dtypes(include=['object']).columns.tolist())
|
| 75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
#===check keywords===
|
| 60 |
@st.cache_data(ttl=3600)
|
| 61 |
def get_data(extype):
|
| 62 |
+
keycheck = list(data.columns)
|
| 63 |
+
keycheck = [k for k in list_of_column_key if 'Keyword' in k]
|
| 64 |
+
return keycheck
|
| 65 |
|
| 66 |
+
keycheck = get_data(extype)
|
| 67 |
|
| 68 |
+
if not keycheck:
|
| 69 |
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'.")
|
| 70 |
else:
|
| 71 |
+
st.write('✅ Keywords Stem')
|
| 72 |
|
| 73 |
#===check any obj===
|
| 74 |
coldf = sorted(data.select_dtypes(include=['object']).columns.tolist())
|
| 75 |
+
|
| 76 |
+
if not coldf:
|
| 77 |
+
st.error("Unfortunately, you don't have a column containing object in your data. Please check again.")
|
| 78 |
+
else:
|
| 79 |
+
st.write('✅ Topic Modeling')
|
| 80 |
+
|
| 81 |
+
if not keycheck:
|
| 82 |
+
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'.")
|
| 83 |
+
else:
|
| 84 |
+
st.write('✅ Bidirected Network')
|
| 85 |
+
|
| 86 |
+
#===Visualization===
|
| 87 |
+
if 'Publication Year' in data.columns:
|
| 88 |
+
papers.rename(columns={'Publication Year': 'Year', 'Citing Works Count': 'Cited by',
|
| 89 |
+
'Publication Type': 'Document Type', 'Source Title': 'Source title'}, inplace=True)
|
| 90 |
+
|
| 91 |
+
miss_col = [column for column in columns_to_check if column not in data.columns]
|
| 92 |
+
|
| 93 |
+
if not missing_columns:
|
| 94 |
+
st.write('✅ Vizualisation')
|
| 95 |
+
else:
|
| 96 |
+
miss_col_str = ', '.join(miss_col)
|
| 97 |
+
st.write(f"Unfortunately, you don't have: {miss_col_str}. Please check again.")
|