Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -57,43 +57,54 @@ if uploaded_file is not None:
|
|
| 57 |
data = conv_txt(extype)
|
| 58 |
|
| 59 |
#===check keywords===
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
return keycheck
|
| 65 |
-
|
| 66 |
-
keycheck = get_data(extype)
|
| 67 |
-
|
| 68 |
container1 = st.container(border=True)
|
|
|
|
| 69 |
if not keycheck:
|
| 70 |
-
container1.write("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'.")
|
| 71 |
else:
|
| 72 |
-
container1.write('β
Keywords Stem')
|
| 73 |
-
|
| 74 |
#===check any obj===
|
|
|
|
| 75 |
coldf = sorted(data.select_dtypes(include=['object']).columns.tolist())
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
if not coldf:
|
| 78 |
-
|
| 79 |
else:
|
| 80 |
-
|
| 81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
if not keycheck:
|
| 83 |
-
|
| 84 |
else:
|
| 85 |
-
|
| 86 |
|
| 87 |
#===Visualization===
|
|
|
|
| 88 |
if 'Publication Year' in data.columns:
|
| 89 |
papers.rename(columns={'Publication Year': 'Year', 'Citing Works Count': 'Cited by',
|
| 90 |
'Publication Type': 'Document Type', 'Source Title': 'Source title'}, inplace=True)
|
| 91 |
|
| 92 |
col2check = ['Document Type','Source title','Cited by','Year']
|
| 93 |
miss_col = [column for column in col2check if column not in data.columns]
|
|
|
|
|
|
|
|
|
|
| 94 |
|
| 95 |
if not miss_col:
|
| 96 |
-
|
| 97 |
else:
|
| 98 |
miss_col_str = ', '.join(miss_col)
|
| 99 |
-
|
|
|
|
| 57 |
data = conv_txt(extype)
|
| 58 |
|
| 59 |
#===check keywords===
|
| 60 |
+
st.divider()
|
| 61 |
+
keycheck = list(data.columns)
|
| 62 |
+
keycheck = [k for k in keycheck if 'Keyword' in k]
|
| 63 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
container1 = st.container(border=True)
|
| 65 |
+
container1.subheader('Keyword Stem', divider='brown')
|
| 66 |
if not keycheck:
|
| 67 |
+
container1.write("β 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 |
+
container1.write('β
Congratulations! You can use Keywords Stem')
|
| 70 |
+
|
| 71 |
#===check any obj===
|
| 72 |
+
st.divider()
|
| 73 |
coldf = sorted(data.select_dtypes(include=['object']).columns.tolist())
|
| 74 |
+
|
| 75 |
+
container2 = st.container(border=True)
|
| 76 |
+
container2.subheader('Topic Modeling', divider='brown')
|
| 77 |
|
| 78 |
if not coldf:
|
| 79 |
+
container2.write("β Unfortunately, you don't have a column containing object in your data. Please check again.")
|
| 80 |
else:
|
| 81 |
+
container2.write('β
Congratulations! You can use Topic Modeling')
|
| 82 |
|
| 83 |
+
#===bidirected===
|
| 84 |
+
st.divider()
|
| 85 |
+
|
| 86 |
+
container3 = st.container(border=True)
|
| 87 |
+
container3.subheader('Bidirected Network', divider='brown')
|
| 88 |
+
|
| 89 |
if not keycheck:
|
| 90 |
+
container3.write("β 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'.")
|
| 91 |
else:
|
| 92 |
+
container3.write('β
Congratulations! You can use Bidirected Network')
|
| 93 |
|
| 94 |
#===Visualization===
|
| 95 |
+
st.divider()
|
| 96 |
if 'Publication Year' in data.columns:
|
| 97 |
papers.rename(columns={'Publication Year': 'Year', 'Citing Works Count': 'Cited by',
|
| 98 |
'Publication Type': 'Document Type', 'Source Title': 'Source title'}, inplace=True)
|
| 99 |
|
| 100 |
col2check = ['Document Type','Source title','Cited by','Year']
|
| 101 |
miss_col = [column for column in col2check if column not in data.columns]
|
| 102 |
+
|
| 103 |
+
container4 = st.container(border=True)
|
| 104 |
+
container4.subheader('Sunburst', divider='brown')
|
| 105 |
|
| 106 |
if not miss_col:
|
| 107 |
+
container4.write('β
Congratulations! You can use Sunburst')
|
| 108 |
else:
|
| 109 |
miss_col_str = ', '.join(miss_col)
|
| 110 |
+
container4.write(f"β Unfortunately, you don't have: {miss_col_str}. Please check again.")
|