Spaces:
Runtime error
Runtime error
Vincent Claes
commited on
Commit
·
f3c9931
1
Parent(s):
245ba2a
use markdown to plot scores
Browse files- app.py +5 -5
- recruiting_assistant.py +25 -1
app.py
CHANGED
@@ -2,7 +2,6 @@ import json
|
|
2 |
import os
|
3 |
import gradio as gr
|
4 |
import requests
|
5 |
-
import intro
|
6 |
import recruiting_assistant
|
7 |
|
8 |
|
@@ -83,7 +82,7 @@ with demo:
|
|
83 |
""")
|
84 |
text_vacancy = gr.Textbox(hint="Paste here a Vacancy...", lines=7, label="Copy/paste here a vacancy")
|
85 |
b1 = gr.Button("Search Resume")
|
86 |
-
text_search_result = gr.Textbox(hint="Top resumes will appear here ...", label="Top resumes found in the database")
|
87 |
b1.click(search_resume, inputs=text_vacancy, outputs=text_search_result)
|
88 |
gr.Markdown("""
|
89 |
## 2. Select an appropriate resume for this vacancy, paste it in the textfield and write a relevant introduction email
|
@@ -93,8 +92,9 @@ with demo:
|
|
93 |
gr.Markdown("""
|
94 |
## 3. You have a relevant introduction email to send to the customer
|
95 |
""")
|
96 |
-
text_intro = gr.Textbox(label="Intro Email")
|
97 |
-
evaluation = gr.Textbox(label="Evaluation of the skills")
|
|
|
98 |
b2.click(recruiting_assistant.create_intro,
|
99 |
inputs=[
|
100 |
text_vacancy,
|
@@ -103,7 +103,7 @@ with demo:
|
|
103 |
outputs=[text_intro, evaluation]
|
104 |
)
|
105 |
|
106 |
-
|
107 |
examples=examples,
|
108 |
fn=search_resume,
|
109 |
inputs=text_vacancy,
|
|
|
2 |
import os
|
3 |
import gradio as gr
|
4 |
import requests
|
|
|
5 |
import recruiting_assistant
|
6 |
|
7 |
|
|
|
82 |
""")
|
83 |
text_vacancy = gr.Textbox(hint="Paste here a Vacancy...", lines=7, label="Copy/paste here a vacancy")
|
84 |
b1 = gr.Button("Search Resume")
|
85 |
+
text_search_result = gr.Textbox(hint="Top resumes will appear here ...", label="Top resumes found in the database", enable_markdown=True)
|
86 |
b1.click(search_resume, inputs=text_vacancy, outputs=text_search_result)
|
87 |
gr.Markdown("""
|
88 |
## 2. Select an appropriate resume for this vacancy, paste it in the textfield and write a relevant introduction email
|
|
|
92 |
gr.Markdown("""
|
93 |
## 3. You have a relevant introduction email to send to the customer
|
94 |
""")
|
95 |
+
text_intro = gr.Textbox(label="Intro Email", enable_markdown=True)
|
96 |
+
# evaluation = gr.Textbox(label="Evaluation of the skills", enable_markdown=True)
|
97 |
+
evaluation = gr.Markdown(label="Evaluation of the skills")
|
98 |
b2.click(recruiting_assistant.create_intro,
|
99 |
inputs=[
|
100 |
text_vacancy,
|
|
|
103 |
outputs=[text_intro, evaluation]
|
104 |
)
|
105 |
|
106 |
+
gr.Examples(
|
107 |
examples=examples,
|
108 |
fn=search_resume,
|
109 |
inputs=text_vacancy,
|
recruiting_assistant.py
CHANGED
@@ -171,9 +171,33 @@ def create_intro(vacancy=vacancy, resume=resume):
|
|
171 |
|
172 |
result = match_resume_vacancy_skills_chain({"vacancy": vacancy, "resume": resume})
|
173 |
print(result)
|
174 |
-
return result["introduction_email"], json.dumps({"resume skills":result['resume_skills'], "check_past_experiences": result['check_past_experiences']}, indent=4)
|
175 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
|
178 |
if __name__ == '__main__':
|
179 |
create_intro(vacancy=vacancy,resume=resume)
|
|
|
171 |
|
172 |
result = match_resume_vacancy_skills_chain({"vacancy": vacancy, "resume": resume})
|
173 |
print(result)
|
|
|
174 |
|
175 |
+
resume_skills = json.loads(result['resume_skills'])
|
176 |
+
relevant_skills = len(resume_skills["skills_present"])
|
177 |
+
total_skills = len(resume_skills["skills_present"] + resume_skills["skills_not_present"])
|
178 |
+
score_skills = round(100.0*(relevant_skills/total_skills),2)
|
179 |
+
|
180 |
+
|
181 |
+
check_past_experiences = json.loads(result['check_past_experiences'])
|
182 |
+
relevant_experiences = len(check_past_experiences["relevant_experiences"])
|
183 |
+
total_experiences = len(check_past_experiences["relevant_experiences"] + check_past_experiences["irrelevant_experiences"])
|
184 |
+
score_experiences = round(100.0*(relevant_experiences/total_experiences),2)
|
185 |
+
|
186 |
+
new_line = '\n'
|
187 |
+
|
188 |
+
score = f"""
|
189 |
+
## Skills (Score: {score_skills}%)
|
190 |
+
Relevant Skills: {",".join(resume_skills["skills_present"])}
|
191 |
+
Not Relevant Skills: {",".join(resume_skills["skills_not_present"])}
|
192 |
|
193 |
+
|
194 |
+
## Experience (Score: {score_experiences}%)
|
195 |
+
Relevant experience: {(new_line+"-").join(check_past_experiences["relevant_experiences"])}
|
196 |
+
Not Relevant experience: {(new_line+"-").join(check_past_experiences["irrelevant_experiences"])}
|
197 |
+
|
198 |
+
"""
|
199 |
+
# return result["introduction_email"], json.dumps({"resume skills":result['resume_skills'], "check_past_experiences": result['check_past_experiences']}, indent=4)
|
200 |
+
return result["introduction_email"], score
|
201 |
|
202 |
if __name__ == '__main__':
|
203 |
create_intro(vacancy=vacancy,resume=resume)
|