nlpblogs commited on
Commit
99f18bc
·
verified ·
1 Parent(s): 7b3f010

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -13
app.py CHANGED
@@ -40,7 +40,7 @@ with st.sidebar:
40
  ''')
41
 
42
 
43
- txt = st.text_area("Job description", key = "text 1")
44
  job = pd.Series(txt, name="Text")
45
 
46
 
@@ -51,7 +51,7 @@ max_attempts = 3
51
 
52
  if st.session_state['upload_count'] < max_attempts:
53
  uploaded_files = st.file_uploader(
54
- "Choose a PDF file", accept_multiple_files=True, type="pdf", key="candidate 1"
55
  )
56
 
57
  if uploaded_files:
@@ -74,34 +74,32 @@ for uploaded_file in uploaded_files:
74
  df = pd.DataFrame(entities)
75
 
76
 
77
- import plotly.express as px
78
  fig = px.treemap(entities, path=[px.Constant("all"), 'text', 'label'],
79
  values='score', color='label')
80
  fig.update_layout(margin = dict(t=50, l=25, r=25, b=25))
81
- st.plotly_chart(fig)
82
 
83
 
84
 
85
  vectorizer = TfidfVectorizer()
86
  tfidf_matrix = vectorizer.fit_transform(result)
87
  tfidf_df = pd.DataFrame(tfidf_matrix.toarray(), columns=vectorizer.get_feature_names_out())
88
- st.subheader("TF-IDF Values:")
89
-
90
-
91
  cosine_sim_matrix = cosine_similarity(tfidf_matrix)
92
  cosine_sim_df = pd.DataFrame(cosine_sim_matrix)
93
 
94
 
95
 
96
 
97
- fig = px.imshow(cosine_sim_df, text_auto=True, labels=dict(x="Cosine similarity", y="Text", color="Productivity"),
98
- x=['text1', 'Jon Description'],
99
- y=['text1', 'Job Description'])
100
- st.plotly_chart(fig)
101
 
102
- st.subheader("Cosine Similarity Scores (Job Description vs. Resumes):")
103
  for i, similarity_score in enumerate(cosine_sim_matrix[0][1:]):
104
- st.write(f"Similarity with Candidate Profile {i + 1}: {similarity_score:.4f}")
105
 
106
  else:
107
  st.warning(f"You have reached the maximum URL attempts ({max_attempts}).")
@@ -109,3 +107,15 @@ else:
109
  if 'upload_count' in st.session_state and st.session_state['upload_count'] > 0:
110
  st.info(f"Files uploaded {st.session_state['upload_count']} time(s).")
111
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  ''')
41
 
42
 
43
+ txt = st.text_area("Paste the job description and then press Ctrl + Enter", key = "text 1")
44
  job = pd.Series(txt, name="Text")
45
 
46
 
 
51
 
52
  if st.session_state['upload_count'] < max_attempts:
53
  uploaded_files = st.file_uploader(
54
+ "Upload your resume in .pdf format", accept_multiple_files=True, type="pdf", key="candidate 1"
55
  )
56
 
57
  if uploaded_files:
 
74
  df = pd.DataFrame(entities)
75
 
76
 
77
+
78
  fig = px.treemap(entities, path=[px.Constant("all"), 'text', 'label'],
79
  values='score', color='label')
80
  fig.update_layout(margin = dict(t=50, l=25, r=25, b=25))
81
+ st.plotly_chart(fig, key = "figure 1")
82
 
83
 
84
 
85
  vectorizer = TfidfVectorizer()
86
  tfidf_matrix = vectorizer.fit_transform(result)
87
  tfidf_df = pd.DataFrame(tfidf_matrix.toarray(), columns=vectorizer.get_feature_names_out())
88
+
 
 
89
  cosine_sim_matrix = cosine_similarity(tfidf_matrix)
90
  cosine_sim_df = pd.DataFrame(cosine_sim_matrix)
91
 
92
 
93
 
94
 
95
+ fig = px.imshow(cosine_sim_df, text_auto=True, labels=dict(x="Keyword similarity", y="Resumes", color="Productivity"),
96
+ x=['Resume 1', 'Jon Description'],
97
+ y=['Resume 1', 'Job Description'])
98
+ st.plotly_chart(fig, key = "figure 2")
99
 
100
+
101
  for i, similarity_score in enumerate(cosine_sim_matrix[0][1:]):
102
+ st.write(f"Similarity with Candidate Profile. A score closer to 1 means higher similarity. {i + 1}: {similarity_score:.4f}")
103
 
104
  else:
105
  st.warning(f"You have reached the maximum URL attempts ({max_attempts}).")
 
107
  if 'upload_count' in st.session_state and st.session_state['upload_count'] > 0:
108
  st.info(f"Files uploaded {st.session_state['upload_count']} time(s).")
109
 
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+