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