faizhalas commited on
Commit
8f2d523
Β·
verified Β·
1 Parent(s): 321363e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -42
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
- #===check keywords===
60
- keycheck = list(data.columns)
61
- keycheck = [k for k in keycheck if 'Keyword' in k]
62
 
63
- container1 = st.container(border=True)
64
- container1.subheader('Keyword Stem', divider='red')
65
- if not keycheck:
66
- 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'.")
67
- else:
68
- container1.write('βœ… Congratulations! You can use Keywords Stem')
69
 
70
- #===check any obj===
71
- coldf = sorted(data.select_dtypes(include=['object']).columns.tolist())
72
-
73
- container2 = st.container(border=True)
74
- container2.subheader('Topic Modeling', divider='red')
 
 
 
 
75
 
76
- if not coldf:
77
- container2.write("❌ Unfortunately, you don't have a column containing object in your data. Please check again.")
78
- else:
79
- container2.write('βœ… Congratulations! You can use Topic Modeling')
80
-
81
- #===bidirected===
82
- container3 = st.container(border=True)
83
- container3.subheader('Bidirected Network', divider='red')
 
 
 
 
 
 
 
 
 
84
 
85
- if not keycheck:
86
- 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'.")
87
- else:
88
- container3.write('βœ… Congratulations! You can use Bidirected Network')
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
- if not miss_col:
102
- container4.write('βœ… Congratulations! You can use Sunburst')
103
- else:
104
- miss_col_str = ', '.join(miss_col)
105
- container4.write(f"❌ Unfortunately, you don't have: {miss_col_str}. Please check again.")
 
 
 
 
 
 
 
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.")