Spaces:
Runtime error
Runtime error
Karthikeyan
commited on
Commit
•
c45ac45
0
Parent(s):
Duplicate from hudsonhayes/Vodafone_Resume_Analyzer
Browse files- .gitattributes +35 -0
- README.md +13 -0
- app.py +88 -0
- requirements.txt +3 -0
- style.css +36 -0
.gitattributes
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
README.md
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: Vodafone Resume Analyzer
|
3 |
+
emoji: 📈
|
4 |
+
colorFrom: purple
|
5 |
+
colorTo: pink
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.35.2
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
duplicated_from: hudsonhayes/Vodafone_Resume_Analyzer
|
11 |
+
---
|
12 |
+
|
13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import PyPDF2
|
3 |
+
import os
|
4 |
+
import openai
|
5 |
+
|
6 |
+
def extract_text_from_file(file_path):
|
7 |
+
# Get the file extension
|
8 |
+
file_extension = os.path.splitext(file_path)[1]
|
9 |
+
|
10 |
+
if file_extension == '.pdf':
|
11 |
+
with open(file_path, 'rb') as file:
|
12 |
+
# Create a PDF file reader object
|
13 |
+
reader = PyPDF2.PdfFileReader(file)
|
14 |
+
|
15 |
+
# Create an empty string to hold the extracted text
|
16 |
+
extracted_text = ""
|
17 |
+
|
18 |
+
# Loop through each page in the PDF and extract the text
|
19 |
+
for page_number in range(reader.getNumPages()):
|
20 |
+
page = reader.getPage(page_number)
|
21 |
+
extracted_text += page.extractText()
|
22 |
+
return extracted_text
|
23 |
+
|
24 |
+
elif file_extension == '.txt':
|
25 |
+
with open(file_path, 'r') as file:
|
26 |
+
# Just read the entire contents of the text file
|
27 |
+
return file.read()
|
28 |
+
|
29 |
+
else:
|
30 |
+
return "Unsupported file type"
|
31 |
+
|
32 |
+
def responce_from_ai(textjd, textcv):
|
33 |
+
resume = extract_text_from_file(textjd)
|
34 |
+
job_description = extract_text_from_file(textcv)
|
35 |
+
response = openai.Completion.create(
|
36 |
+
engine="text-davinci-003",
|
37 |
+
prompt=f"""
|
38 |
+
Given the job description and the resume, assess the matching percentage and approximate percentage of the resume for the job.**Job Description:**{job_description}**Resume:**{resume}**Matching Assessment:**Based on an analysis of the resume and the job description,
|
39 |
+
the overall matching percentage is estimated to be approximately [insert approximate percentage here].
|
40 |
+
**Detailed Analysis:**
|
41 |
+
the result should be in this format:
|
42 |
+
matched percentage: [matching percentage]
|
43 |
+
reason : [reason for this result]
|
44 |
+
keywords : [matched key words from job_description and resume]
|
45 |
+
""",
|
46 |
+
temperature=0,
|
47 |
+
max_tokens=100,
|
48 |
+
n=1,
|
49 |
+
stop=None,
|
50 |
+
)
|
51 |
+
generated_text = response.choices[0].text.strip()
|
52 |
+
return generated_text
|
53 |
+
|
54 |
+
def matching_percentage(job_description_path, resume_path):
|
55 |
+
|
56 |
+
job_description_path = job_description_path.name
|
57 |
+
resume_path = resume_path.name
|
58 |
+
|
59 |
+
generated_text = responce_from_ai(job_description_path, resume_path)
|
60 |
+
return generated_text
|
61 |
+
|
62 |
+
|
63 |
+
with gr.Blocks(css="style.css",theme=gr.themes.Soft()) as app:
|
64 |
+
gr.HTML("""<img class="leftimage" align="left" src="https://templates.images.credential.net/1612472097627370951721412474196.png" alt="Image" width="210" height="210">
|
65 |
+
<img class="rightimage" align="right" src="https://upload.wikimedia.org/wikipedia/en/thumb/c/cc/Vodafone_2017_logo.svg/2560px-Vodafone_2017_logo.svg.png" alt="Image" width="200" height="200">""")
|
66 |
+
|
67 |
+
with gr.Row():
|
68 |
+
with gr.Column(elem_id="col-container"):
|
69 |
+
gr.HTML(
|
70 |
+
"""<br style="color:white;">"""
|
71 |
+
)
|
72 |
+
gr.HTML(
|
73 |
+
"""<h2 style="text-align:center; color:"white">Vodafone Resume Matcher</h2> """
|
74 |
+
)
|
75 |
+
gr.HTML("<br>")
|
76 |
+
with gr.Row():
|
77 |
+
with gr.Column(scale=0.45, min_width=150, ):
|
78 |
+
jobDescription = gr.inputs.File(label="Job Description")
|
79 |
+
with gr.Column(scale=0.45, min_width=150):
|
80 |
+
resume = gr.inputs.File(label="Resume")
|
81 |
+
with gr.Column(scale=0.10, min_width=150):
|
82 |
+
find = gr.Button("Find")
|
83 |
+
with gr.Row():
|
84 |
+
with gr.Column(scale=1.0, min_width=150):
|
85 |
+
output = gr.outputs.Textbox(label="Matching Percentage")
|
86 |
+
|
87 |
+
find.click(matching_percentage, [jobDescription, resume], [output])
|
88 |
+
app.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
openai
|
2 |
+
gradio
|
3 |
+
PyPDF2==2.12.1
|
style.css
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#col-container {
|
2 |
+
max-width: 600px;
|
3 |
+
margin-left: auto;
|
4 |
+
margin-right: auto;
|
5 |
+
}
|
6 |
+
|
7 |
+
#row-flex {
|
8 |
+
display: flex;
|
9 |
+
align-items: center;
|
10 |
+
justify-content: center;
|
11 |
+
}
|
12 |
+
.leftimage .rightimage{
|
13 |
+
float:left;
|
14 |
+
filter: drop-shadow(20px 20px 10px white);
|
15 |
+
}
|
16 |
+
.leftimage{
|
17 |
+
padding-top:40px;
|
18 |
+
margin-left:310px;
|
19 |
+
}
|
20 |
+
.rightimage{
|
21 |
+
padding-top:30px;
|
22 |
+
margin-right:320px;
|
23 |
+
}
|
24 |
+
a,
|
25 |
+
a:hover,
|
26 |
+
a:visited {
|
27 |
+
text-decoration-line: underline;
|
28 |
+
font-weight: 600;
|
29 |
+
color: #1f2937 !important;
|
30 |
+
}
|
31 |
+
|
32 |
+
.dark a,
|
33 |
+
.dark a:hover,
|
34 |
+
.dark a:visited {
|
35 |
+
color: #f3f4f6 !important;
|
36 |
+
}
|