Update app.py
Browse files
app.py
CHANGED
@@ -125,12 +125,13 @@ if st.session_state['upload_count'] < max_attempts:
|
|
125 |
entities = model.predict_entities(text_data, labels)
|
126 |
df = pd.DataFrame(entities)
|
127 |
|
128 |
-
tab1, tab2
|
129 |
-
with
|
130 |
-
|
|
|
131 |
values='score', color='label')
|
132 |
-
|
133 |
-
|
134 |
|
135 |
vectorizer = TfidfVectorizer()
|
136 |
tfidf_matrix = vectorizer.fit_transform(result)
|
@@ -138,20 +139,17 @@ if st.session_state['upload_count'] < max_attempts:
|
|
138 |
cosine_sim_matrix = cosine_similarity(tfidf_matrix)
|
139 |
cosine_sim_df = pd.DataFrame(cosine_sim_matrix)
|
140 |
|
141 |
-
|
142 |
-
|
143 |
labels=dict(x="Keyword similarity", y="Resumes", color="Productivity"),
|
144 |
x=['Resume', 'Jon Description'],
|
145 |
y=['Resume', 'Job Description'])
|
146 |
-
|
147 |
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
with st.popover("See result"):
|
153 |
-
st.write(f"Similarity of job description with Applicant's 1 resume based on keywords: {similarity_score:.2f}")
|
154 |
-
st.info(
|
155 |
"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.")
|
156 |
else:
|
157 |
st.warning(f"You have reached the maximum upload attempts ({max_attempts}).")
|
|
|
125 |
entities = model.predict_entities(text_data, labels)
|
126 |
df = pd.DataFrame(entities)
|
127 |
|
128 |
+
tab1, tab2 = st.tabs(["Applicant's Profile", "Similarity"])
|
129 |
+
with st.spinner("Wait for it...", show_time=True):
|
130 |
+
with tab1:
|
131 |
+
fig = px.treemap(entities, path=[px.Constant("all"), 'text', 'label'],
|
132 |
values='score', color='label')
|
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)
|
|
|
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}).")
|