nlpblogs commited on
Commit
784e033
·
verified ·
1 Parent(s): 50f674a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -42
app.py CHANGED
@@ -61,7 +61,9 @@ if st.session_state['upload_count'] < max_attempts:
61
  text_data = ""
62
  for page in pdf_reader.pages:
63
  text_data += page.extract_text()
64
- st.text_area("Applicant's 1 resume", value = text_data, height = 300, key = "text 2")
 
 
65
  data = pd.Series(text_data, name='Text')
66
  frames = [job, data]
67
  result = pd.concat(frames)
@@ -100,7 +102,10 @@ if st.session_state['upload_count'] < max_attempts:
100
  text_data = ""
101
  for page in pdf_reader.pages:
102
  text_data += page.extract_text()
103
- st.text_area("Applicant's 2 resume", value = text_data, height = 300, key = "text 2")
 
 
 
104
  data = pd.Series(text_data, name='Text')
105
  frames = [job, data]
106
  result = pd.concat(frames)
@@ -124,47 +129,8 @@ else:
124
 
125
 
126
 
127
- st.subheader("Applicant Resume 3", divider="green")
128
- if 'upload_count' not in st.session_state:
129
- st.session_state['upload_count'] = 0
130
-
131
- max_attempts = 3
132
- if st.session_state['upload_count'] < max_attempts:
133
- uploaded_files = st.file_uploader("Upload Applicant's 3 resume", type="pdf", key="candidate 3")
134
- if uploaded_files:
135
- st.session_state['upload_count'] += 1
136
-
137
- pdf_reader = PdfReader(uploaded_files)
138
- text_data = ""
139
- for page in pdf_reader.pages:
140
- text_data += page.extract_text()
141
- st.text_area("Applicant's 3 resume", value = text_data, height = 300, key = "text 2")
142
- data = pd.Series(text_data, name='Text')
143
- frames = [job, data]
144
- result = pd.concat(frames)
145
-
146
-
147
- vectorizer = TfidfVectorizer()
148
- tfidf_matrix = vectorizer.fit_transform(result)
149
- tfidf_df = pd.DataFrame(tfidf_matrix.toarray(), columns=vectorizer.get_feature_names_out())
150
- cosine_sim_matrix = cosine_similarity(tfidf_matrix)
151
- cosine_sim_df = pd.DataFrame(cosine_sim_matrix)
152
-
153
- for i, similarity_score in enumerate(cosine_sim_matrix[0][1:]):
154
- with st.popover("See result"):
155
- st.write(f"Similarity of job description with Applicant's 3 resume based on keywords: {similarity_score:.2f}")
156
- st.info(
157
- "A score closer to 1 (0.80, 0.90) means higher similarity between Applicant's 3 resume and job description. A score closer to 0 (0.20, 0.30) means lower similarity between Applicant's 3 resume and job description.")
158
- else:
159
- st.warning(f"You have reached the maximum upload attempts ({max_attempts}).")
160
- if 'upload_count' in st.session_state and st.session_state['upload_count'] > 0:
161
- st.info(f"Files uploaded {st.session_state['upload_count']} time(s).")
162
-
163
-
164
-
165
-
166
-
167
 
 
168
 
169
 
170
 
 
61
  text_data = ""
62
  for page in pdf_reader.pages:
63
  text_data += page.extract_text()
64
+ with st.expander("See Applicant'1 resume"):
65
+ st.write("text_data")
66
+
67
  data = pd.Series(text_data, name='Text')
68
  frames = [job, data]
69
  result = pd.concat(frames)
 
102
  text_data = ""
103
  for page in pdf_reader.pages:
104
  text_data += page.extract_text()
105
+ with st.expander("See Applicant'2 Resume"):
106
+ st.write("text_data")
107
+
108
+
109
  data = pd.Series(text_data, name='Text')
110
  frames = [job, data]
111
  result = pd.concat(frames)
 
129
 
130
 
131
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
 
133
+
134
 
135
 
136