nlpblogs commited on
Commit
4f1100d
·
verified ·
1 Parent(s): dac44fa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -33
app.py CHANGED
@@ -105,15 +105,15 @@ for i in range(1, 51): # Looping for 2 applicants
105
  st.divider()
106
 
107
 
108
- st.subheader("Visualise Applicant's Profile", divider="blue")
109
  if 'upload_count' not in st.session_state:
110
  st.session_state['upload_count'] = 0
111
 
112
  max_attempts = 3
113
  if st.session_state['upload_count'] < max_attempts:
114
  uploaded_files = st.file_uploader("Upload Applicant's resume", type="pdf", key = "applicant 1")
115
- if uploaded_files:
116
- st.session_state['upload_count'] += 1
117
 
118
  with st.spinner("Wait for it...", show_time=True):
119
  time.sleep(2)
@@ -133,34 +133,7 @@ if uploaded_files:
133
  values='score', color='label')
134
  fig.update_layout(margin=dict(t=50, l=25, r=25, b=25))
135
  st.plotly_chart(fig, key = "figure 1")
136
- else:
137
- st.warning(f"You have reached the maximum upload attempts ({max_attempts}).")
138
- if 'upload_count' in st.session_state and st.session_state['upload_count'] > 0:
139
- st.info(f"Files uploaded {st.session_state['upload_count']} time(s).")
140
 
141
-
142
-
143
-
144
- st.subheader("Visualise Similarity", divider="blue")
145
- if 'upload_count' not in st.session_state:
146
- st.session_state['upload_count'] = 0
147
- max_attempts = 3
148
- if st.session_state['upload_count'] < max_attempts:
149
- uploaded_files = st.file_uploader("Upload Applicant's resume", type="pdf", key = "applicant 2")
150
- if uploaded_files:
151
- st.session_state['upload_count'] += 1
152
-
153
- with st.spinner("Wait for it...", show_time=True):
154
- time.sleep(2)
155
- pdf_reader = PdfReader(uploaded_files)
156
- text_data = ""
157
- for page in pdf_reader.pages:
158
- text_data += page.extract_text()
159
-
160
- data = pd.Series(text_data, name='Text')
161
- frames = [job, data]
162
- result = pd.concat(frames)
163
-
164
  vectorizer = TfidfVectorizer()
165
  tfidf_matrix = vectorizer.fit_transform(result)
166
  tfidf_df = pd.DataFrame(tfidf_matrix.toarray(), columns=vectorizer.get_feature_names_out())
@@ -173,13 +146,15 @@ if uploaded_files:
173
  x=['Resume', 'Jon Description'],
174
  y=['Resume', 'Job Description'])
175
  st.plotly_chart(fig, key="figure 2")
176
-
177
-
178
  else:
179
  st.warning(f"You have reached the maximum upload attempts ({max_attempts}).")
180
  if 'upload_count' in st.session_state and st.session_state['upload_count'] > 0:
181
  st.info(f"Files uploaded {st.session_state['upload_count']} time(s).")
182
-
 
 
 
 
183
 
184
 
185
 
 
105
  st.divider()
106
 
107
 
108
+ st.subheader("Visualise", divider="blue")
109
  if 'upload_count' not in st.session_state:
110
  st.session_state['upload_count'] = 0
111
 
112
  max_attempts = 3
113
  if st.session_state['upload_count'] < max_attempts:
114
  uploaded_files = st.file_uploader("Upload Applicant's resume", type="pdf", key = "applicant 1")
115
+ if uploaded_files:
116
+ st.session_state['upload_count'] += 1
117
 
118
  with st.spinner("Wait for it...", show_time=True):
119
  time.sleep(2)
 
133
  values='score', color='label')
134
  fig.update_layout(margin=dict(t=50, l=25, r=25, b=25))
135
  st.plotly_chart(fig, key = "figure 1")
 
 
 
 
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  vectorizer = TfidfVectorizer()
138
  tfidf_matrix = vectorizer.fit_transform(result)
139
  tfidf_df = pd.DataFrame(tfidf_matrix.toarray(), columns=vectorizer.get_feature_names_out())
 
146
  x=['Resume', 'Jon Description'],
147
  y=['Resume', 'Job Description'])
148
  st.plotly_chart(fig, key="figure 2")
 
 
149
  else:
150
  st.warning(f"You have reached the maximum upload attempts ({max_attempts}).")
151
  if 'upload_count' in st.session_state and st.session_state['upload_count'] > 0:
152
  st.info(f"Files uploaded {st.session_state['upload_count']} time(s).")
153
+
154
+
155
+
156
+
157
+
158
 
159
 
160