nlpblogs commited on
Commit
cd63bad
·
verified ·
1 Parent(s): 0d1a3ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -14
app.py CHANGED
@@ -133,24 +133,19 @@ if st.session_state['upload_count'] < max_attempts:
133
  fig.update_layout(margin=dict(t=50, l=25, r=25, b=25))
134
  st.plotly_chart(fig, key="figure 1")
135
 
136
- vectorizer = TfidfVectorizer()
137
- tfidf_matrix = vectorizer.fit_transform(result)
138
- tfidf_df = pd.DataFrame(tfidf_matrix.toarray(), columns=vectorizer.get_feature_names_out())
139
- cosine_sim_matrix = cosine_similarity(tfidf_matrix)
140
- cosine_sim_df = pd.DataFrame(cosine_sim_matrix)
141
-
142
- with tab2:
143
- fig = px.imshow(cosine_sim_df, text_auto=True,
144
  labels=dict(x="Keyword similarity", y="Resumes", color="Productivity"),
145
  x=['Resume', 'Jon Description'],
146
  y=['Resume', 'Job Description'])
147
- st.plotly_chart(fig, key="figure 2")
148
 
149
- for i, similarity_score in enumerate(cosine_sim_matrix[0][1:]):
150
- with st.popover("See result"):
151
- st.write(f"Similarity of job description with Applicant's 1 resume based on keywords: {similarity_score:.2f}")
152
- st.info(
153
- "A score closer to 1 (0.80, 0.90) means higher similarity between Applicant's 1 resume and job description. A score closer to 0 (0.20, 0.30) means lower similarity between Applicant's 1 resume and job description.")
154
  else:
155
  st.warning(f"You have reached the maximum upload attempts ({max_attempts}).")
156
  if 'upload_count' in st.session_state and st.session_state['upload_count'] > 0:
 
133
  fig.update_layout(margin=dict(t=50, l=25, r=25, b=25))
134
  st.plotly_chart(fig, key="figure 1")
135
 
136
+ with tab2:
137
+ vectorizer = TfidfVectorizer()
138
+ tfidf_matrix = vectorizer.fit_transform(result)
139
+ tfidf_df = pd.DataFrame(tfidf_matrix.toarray(), columns=vectorizer.get_feature_names_out())
140
+ cosine_sim_matrix = cosine_similarity(tfidf_matrix)
141
+ cosine_sim_df = pd.DataFrame(cosine_sim_matrix)
142
+ fig = px.imshow(cosine_sim_df, text_auto=True,
 
143
  labels=dict(x="Keyword similarity", y="Resumes", color="Productivity"),
144
  x=['Resume', 'Jon Description'],
145
  y=['Resume', 'Job Description'])
146
+ st.plotly_chart(fig, key="figure 2")
147
 
148
+
 
 
 
 
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: