Update app.py
Browse files
app.py
CHANGED
@@ -110,44 +110,36 @@ if st.session_state['upload_count'] < max_attempts:
|
|
110 |
if uploaded_files:
|
111 |
st.session_state['upload_count'] += 1
|
112 |
with st.spinner("Wait for it...", show_time=True):
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
similarity_score = model.similarity(job_embedding, resume_embedding)[0][0]
|
141 |
-
|
142 |
-
|
143 |
-
st.subheader("Similarity between Applicant's Profile and Job Description", divider = "orange")
|
144 |
-
|
145 |
-
fig = px.imshow(similarity_score, text_auto=True,
|
146 |
-
labels=dict(x="Keyword similarity", y="Resumes", color="Productivity"),
|
147 |
-
x=['Resume', 'Jon Description'],
|
148 |
-
y=['Resume', 'Job Description'])
|
149 |
-
st.plotly_chart(fig, key="figure 2")
|
150 |
else:
|
151 |
st.warning(f"Maximum upload attempts has been reached ({max_attempts}).")
|
152 |
if 'upload_count' in st.session_state and st.session_state['upload_count'] > 0:
|
153 |
-
st.info(f"Files uploaded {st.session_state['upload_count']} time(s).")
|
|
|
|
|
|
110 |
if uploaded_files:
|
111 |
st.session_state['upload_count'] += 1
|
112 |
with st.spinner("Wait for it...", show_time=True):
|
113 |
+
time.sleep(2)
|
114 |
+
pdf_reader = PdfReader(uploaded_files)
|
115 |
+
text_data = ""
|
116 |
+
for page in pdf_reader.pages:
|
117 |
+
text_data += page.extract_text()
|
118 |
+
job_desc_series = pd.Series([job_desc], name='Text') # Convert job_desc to a Series
|
119 |
+
data = pd.Series([text_data], name='Text') # Ensure text_data is also a Series
|
120 |
+
frames = [job_desc_series, data]
|
121 |
+
result = pd.concat(frames, ignore_index=True) # Concatenate along rows, reset index
|
122 |
+
model = GLiNER.from_pretrained("urchade/gliner_base")
|
123 |
+
labels = ["person", "country", "organization", "role", "skills"]
|
124 |
+
entities = model.predict_entities(text_data, labels)
|
125 |
+
df = pd.DataFrame(entities)
|
126 |
+
st.subheader("Applicant's Profile", divider = "orange")
|
127 |
+
fig = px.treemap(entities, path=[px.Constant("all"), 'text', 'label'],
|
128 |
+
values='score', color='label')
|
129 |
+
fig.update_layout(margin=dict(t=50, l=25, r=25, b=25))
|
130 |
+
st.plotly_chart(fig, key="figure 1")
|
131 |
+
job_embedding = model.encode([job_desc])
|
132 |
+
resume_embedding = model.encode([text_data])
|
133 |
+
similarity_score = model.similarity(job_embedding, resume_embedding)[0][0]
|
134 |
+
st.subheader("Similarity between Applicant's Profile and Job Description", divider = "orange")
|
135 |
+
fig = px.imshow(similarity_score, text_auto=True,
|
136 |
+
labels=dict(x="Keyword similarity", y="Resumes", color="Productivity"),
|
137 |
+
x=['Resume', 'Jon Description'],
|
138 |
+
y=['Resume', 'Job Description'])
|
139 |
+
st.plotly_chart(fig, key="figure 2")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
else:
|
141 |
st.warning(f"Maximum upload attempts has been reached ({max_attempts}).")
|
142 |
if 'upload_count' in st.session_state and st.session_state['upload_count'] > 0:
|
143 |
+
st.info(f"Files uploaded {st.session_state['upload_count']} time(s).")
|
144 |
+
|
145 |
+
|