Spaces:
Sleeping
Sleeping
Commit
·
3c16641
0
Parent(s):
Duplicate from hudsonhayes/CAC
Browse filesCo-authored-by: Selvam V <[email protected]>
- .gitattributes +36 -0
- README.md +13 -0
- app.py +98 -0
- bg.png +3 -0
- logo.png +0 -0
- requirements.txt +3 -0
- style.css +39 -0
.gitattributes
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
bg.png filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: EmailGenerator
|
3 |
+
emoji: 🐠
|
4 |
+
colorFrom: gray
|
5 |
+
colorTo: purple
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.36.1
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
duplicated_from: hudsonhayes/CAC
|
11 |
+
---
|
12 |
+
|
13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import os
|
3 |
+
import fitz
|
4 |
+
import openai
|
5 |
+
import re
|
6 |
+
|
7 |
+
class ResumeAnalyser:
|
8 |
+
def __init__(self):
|
9 |
+
pass
|
10 |
+
def extract_text_from_file(self, file_path):
|
11 |
+
# Get the file extension
|
12 |
+
file_extension = os.path.splitext(file_path)[1]
|
13 |
+
|
14 |
+
if file_extension == '.pdf':
|
15 |
+
# Use PyMuPDF (fitz) for PDF text extraction
|
16 |
+
doc = fitz.open(file_path)
|
17 |
+
extracted_text = ""
|
18 |
+
for page in doc:
|
19 |
+
extracted_text += page.get_text()
|
20 |
+
doc.close()
|
21 |
+
return extracted_text
|
22 |
+
|
23 |
+
elif file_extension == '.txt':
|
24 |
+
with open(file_path, 'r') as file:
|
25 |
+
# Just read the entire contents of the text file
|
26 |
+
return file.read()
|
27 |
+
else:
|
28 |
+
return "Unsupported file type"
|
29 |
+
|
30 |
+
def responce_from_ai(self,job_description_path, resume_list_path):
|
31 |
+
|
32 |
+
result = ""
|
33 |
+
job_description = self.extract_text_from_file(job_description_path.name)
|
34 |
+
for resume_path in resume_list_path:
|
35 |
+
resume = self.extract_text_from_file(resume_path.name)
|
36 |
+
response = openai.Completion.create(
|
37 |
+
engine = "text-davinci-003",
|
38 |
+
prompt = f"""Given the job description and the resume, assess the matching percentage to 100 and if 100 percentage not matched mention the remaining percentage with reason. **Job Description:**{job_description}**Resume:**{resume}
|
39 |
+
**Detailed Analysis:**
|
40 |
+
Introduction to say we've assessment the resume
|
41 |
+
the result should be in this format:
|
42 |
+
Matched Percentage: Precisely [get matching percentage between job description and resume]%.\n
|
43 |
+
Qualification Matching Percentage: [matching percentage between job description and resume qualifications].\n
|
44 |
+
Skills Matching Percentage: [matching percentage between job description and resume skills].\n
|
45 |
+
Experience Matching Percentage: [matching percentage between job description and resume experience].\n
|
46 |
+
Reason : [Reasons for why this resume matched and not matched.].\n
|
47 |
+
Skills To Improve : [Mention the skills to improve for the candidate according to the given job description. If there are no matches, simply say N/A.].\n
|
48 |
+
Keywords : [Return the matched keywords from resume and job_description. If there are no matches, simply say N/A.]\n
|
49 |
+
Company : [Extracted company name from job description].\n
|
50 |
+
Irrevelant: [mention the irrevelant skills and expericence]\n
|
51 |
+
Recommend Course: [mention specific course to recommend the candidate for job description needs].\n
|
52 |
+
Experience: [mention specific experience to recommend the candidate for job description needs].\n
|
53 |
+
Tailor Your Application: [Emphasize relevant areas].\n
|
54 |
+
Certifications: [Pursue certifications in mention area].\n
|
55 |
+
Feel free to contact us for further clarification.\n
|
56 |
+
Best wishes,
|
57 |
+
Your job is to write a proper E-Mail to the candidate from the organization with the job role, the candidate's name, organization name, and the body of this E-Mail should be in the above format.""",
|
58 |
+
temperature=0,
|
59 |
+
max_tokens=1000,
|
60 |
+
stop=None,
|
61 |
+
)
|
62 |
+
generated_text = response.choices[0].text.strip()
|
63 |
+
result += generated_text + "\n-------------------------------------------------------------------------------------\n"
|
64 |
+
return result
|
65 |
+
|
66 |
+
def clear(self,jobDescription,resume,result_email):
|
67 |
+
jobDescription = None
|
68 |
+
resume = None
|
69 |
+
result_email = None
|
70 |
+
return jobDescription, resume, result_email
|
71 |
+
|
72 |
+
def gradio_interface(self):
|
73 |
+
with gr.Blocks(css="style.css",theme='karthikeyan-adople/hudsonhayes-gray') as app:
|
74 |
+
gr.HTML("""<center class="darkblue" style='background-color:rgb(0,1,36); text-align:center;padding:25px;'><center><h1 class ="center">
|
75 |
+
<img src="file=logo.png" height="110px" width="280px"></h1></center>
|
76 |
+
<br><h1 style="color:#fff">Candidate Assessment and Communication</h1></center>""")
|
77 |
+
with gr.Row(elem_id="col-container"):
|
78 |
+
with gr.Column(scale=0.55, min_width=150, ):
|
79 |
+
jobDescription = gr.File(label="Job Description", file_types = [".pdf",".txt"])
|
80 |
+
with gr.Column(scale=0.55, min_width=150):
|
81 |
+
resume = gr.File(label="Resume", file_types = [".pdf",".txt"] , file_count="multiple")
|
82 |
+
with gr.Row(elem_id="col-container"):
|
83 |
+
with gr.Column(scale=0.80, min_width=150):
|
84 |
+
analyse = gr.Button("Analyse")
|
85 |
+
with gr.Column(scale=0.20, min_width=150):
|
86 |
+
clear_btn = gr.ClearButton()
|
87 |
+
with gr.Row(elem_id="col-container"):
|
88 |
+
with gr.Column(scale=1.0, min_width=150):
|
89 |
+
result_email = gr.Textbox(label="E-mail", lines=10)
|
90 |
+
|
91 |
+
analyse.click(self.responce_from_ai, [jobDescription, resume], [result_email])
|
92 |
+
clear_btn.click(self.clear,[jobDescription,resume,result_email],[jobDescription,resume,result_email] )
|
93 |
+
|
94 |
+
app.launch()
|
95 |
+
|
96 |
+
if __name__ == "__main__":
|
97 |
+
resume = ResumeAnalyser()
|
98 |
+
answer = resume.gradio_interface()
|
bg.png
ADDED
![]() |
Git LFS Details
|
logo.png
ADDED
![]() |
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
openai
|
2 |
+
gradio
|
3 |
+
PyMuPDF
|
style.css
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#col-container {
|
2 |
+
max-width: 600px;
|
3 |
+
margin-left: auto;
|
4 |
+
margin-right: auto;
|
5 |
+
}
|
6 |
+
gradio-app{
|
7 |
+
background:url("file=bg.png") !important;
|
8 |
+
}
|
9 |
+
|
10 |
+
#row-flex {
|
11 |
+
display: flex;
|
12 |
+
align-items: center;
|
13 |
+
justify-content: center;
|
14 |
+
}
|
15 |
+
.leftimage .rightimage{
|
16 |
+
float:left;
|
17 |
+
filter: drop-shadow(20px 20px 10px white);
|
18 |
+
}
|
19 |
+
.leftimage{
|
20 |
+
padding-top:40px;
|
21 |
+
margin-left:310px;
|
22 |
+
}
|
23 |
+
.rightimage{
|
24 |
+
padding-top:40px;
|
25 |
+
margin-right:320px;
|
26 |
+
}
|
27 |
+
a,
|
28 |
+
a:hover,
|
29 |
+
a:visited {
|
30 |
+
text-decoration-line: underline;
|
31 |
+
font-weight: 600;
|
32 |
+
color: #1f2937 !important;
|
33 |
+
}
|
34 |
+
|
35 |
+
.dark a,
|
36 |
+
.dark a:hover,
|
37 |
+
.dark a:visited {
|
38 |
+
color: #f3f4f6 !important;
|
39 |
+
}
|