Spaces:
Sleeping
Sleeping
Commit
•
969338f
1
Parent(s):
c21bfca
Upload 2 files
Browse files- app.py +142 -0
- requirements.txt +8 -0
app.py
ADDED
@@ -0,0 +1,142 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
from dotenv import load_dotenv
|
3 |
+
load_dotenv()
|
4 |
+
|
5 |
+
import streamlit as st
|
6 |
+
import os
|
7 |
+
import io
|
8 |
+
import base64
|
9 |
+
from PIL import Image
|
10 |
+
import pdf2image
|
11 |
+
import google.generativeai as genai
|
12 |
+
|
13 |
+
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
14 |
+
|
15 |
+
def get_gemini_response(input, pdf_content, prompt):
|
16 |
+
try:
|
17 |
+
model = genai.GenerativeModel('gemini-pro-vision')
|
18 |
+
response = model.generate_content([input, pdf_content[0], prompt])
|
19 |
+
return response.text
|
20 |
+
except Exception as e:
|
21 |
+
# Handle specific exceptions here (e.g., ConnectionError, ValueError, etc.)
|
22 |
+
return f"Error occurred: {str(e)}"
|
23 |
+
|
24 |
+
def input_pdf_setup(uploaded_file):
|
25 |
+
if uploaded_file is not None:
|
26 |
+
## Convert the PDF to image
|
27 |
+
images=pdf2image.convert_from_bytes(uploaded_file.read())
|
28 |
+
|
29 |
+
first_page=images[0]
|
30 |
+
|
31 |
+
# Convert to bytes
|
32 |
+
img_byte_arr = io.BytesIO()
|
33 |
+
first_page.save(img_byte_arr, format='JPEG')
|
34 |
+
img_byte_arr = img_byte_arr.getvalue()
|
35 |
+
|
36 |
+
pdf_parts = [
|
37 |
+
{
|
38 |
+
"mime_type": "image/jpeg",
|
39 |
+
"data": base64.b64encode(img_byte_arr).decode() # encode to base64
|
40 |
+
}
|
41 |
+
]
|
42 |
+
return pdf_parts
|
43 |
+
else:
|
44 |
+
raise FileNotFoundError("No file uploaded")
|
45 |
+
|
46 |
+
## Streamlit APP
|
47 |
+
|
48 |
+
st.set_page_config(page_title="ATS Resume Expert")
|
49 |
+
st.header("JobFit Resume ATS")
|
50 |
+
input_JD = st.text_area("Job Description: ", key='input')
|
51 |
+
uploaded_file = st.file_uploader("Upload your Resume(PDF)...",type=["pdf"])
|
52 |
+
|
53 |
+
if uploaded_file is not None:
|
54 |
+
st.write("PDF Uploaded successfully")
|
55 |
+
|
56 |
+
submit1 = st.button("Tell me about the Resume")
|
57 |
+
|
58 |
+
submit2 = st.button("How can I improvise my skills")
|
59 |
+
|
60 |
+
submit3 = st.button("Percentage match")
|
61 |
+
|
62 |
+
submit4 = st.button("Missing keywords compared to Job description")
|
63 |
+
|
64 |
+
input_prompt1 = """
|
65 |
+
You are an experienced Technical Human Resource Manager with wide range of exposure to several prominent Technology fields like
|
66 |
+
Data Science, AI Engineering, Full stack webdevelopment, Devops etc.,
|
67 |
+
you will be provided with a summary of resume and a job descrption.
|
68 |
+
your task is to review the provided resume against the provided job description of any one of the job role from the above mentioned technologies.
|
69 |
+
Please make share your professional evaluation on whether the candidate's profile aligns with the role.
|
70 |
+
Highlight the strengths and weaknesses of the applicant in relation to the specified job requirements.
|
71 |
+
Analyse the qualifications, experience, education and other relevant details of the CV.
|
72 |
+
explain why or whynot the candidate met the fits in the position
|
73 |
+
|
74 |
+
"""
|
75 |
+
input_prompt2 = """
|
76 |
+
You are an experienced Technical Human Resource Manager with wide range of exposure to several prominent Technology fields like
|
77 |
+
Data Science, AI Engineering, Full stack webdevelopment, Devops etc.,
|
78 |
+
you will be provided with a summary of resume and a job descrption.
|
79 |
+
your task is to scrutinize the provided resume in the light of the provided job description of any one of the job role from the above mentioned technologies.
|
80 |
+
Please make share your professional evaluation on whether the candidate's profile aligns with the role.
|
81 |
+
Analyse if the skills and experties of the candidate aligns well with the requirements and responsibilities of the position
|
82 |
+
in job description provided.
|
83 |
+
Analyse the degree of experties required to perform the tasks in the job efficiently and effectively and
|
84 |
+
check if the candidate posses that degree of experties.
|
85 |
+
Explain how well does the candidate possess the requisite knowledge and skill set?
|
86 |
+
Explain the Areas in which the candidate can improve
|
87 |
+
provide suggestions on the areas where the candidate needs to work further.
|
88 |
+
"""
|
89 |
+
input_prompt3 = """
|
90 |
+
You are an skilled ATS (Applicant Tracking System) scanner with a deep understanding several prominent Technology fields like
|
91 |
+
Data Science, AI Engineering, Full stack webdevelopment, Devops etc., and Deep and amazing ATS functionality,
|
92 |
+
your task is to evaluate the resume against the provided job description of any one of the job role from the above mentioned technologies.
|
93 |
+
give the percentage of match if the resume matches
|
94 |
+
the job description. First the output should come as percentage and then provide the percentage of match with the important feilds
|
95 |
+
like education, experience, technical skills , soft skills etc.
|
96 |
+
"""
|
97 |
+
|
98 |
+
input_prompt4 = """
|
99 |
+
You are an experienced Technical Human Resource Manager with wide range of exposure to several prominent Technology fields like
|
100 |
+
Data Science, AI Engineering, Full stack webdevelopment, Devops etc.,
|
101 |
+
you will be provided with a summary of resume and a job descrption.
|
102 |
+
your task is to scrutinize the provided resume in the light of the provided job description of any one of the job role from the above mentioned technologies.
|
103 |
+
Please make share your professional evaluation on whether the candidate's profile aligns with the role.
|
104 |
+
Analyse if the skills and experties of the candidate aligns well with the requirements and responsibilities of the position
|
105 |
+
in job description provided.
|
106 |
+
provide the feedback on what are all the important Technical, soft skills and qualities that are missing in the resume.
|
107 |
+
"""
|
108 |
+
if submit1:
|
109 |
+
if uploaded_file is not None:
|
110 |
+
pdf_content = input_pdf_setup(uploaded_file)
|
111 |
+
response = get_gemini_response(input_prompt1, pdf_content, input_JD)
|
112 |
+
st.subheader('The response is ')
|
113 |
+
st.write(response)
|
114 |
+
else:
|
115 |
+
st.write("please upload the resume PDF and then click submit")
|
116 |
+
|
117 |
+
elif submit2:
|
118 |
+
if uploaded_file is not None:
|
119 |
+
pdf_content = input_pdf_setup(uploaded_file)
|
120 |
+
response = get_gemini_response(input_prompt2, pdf_content, input_JD)
|
121 |
+
st.subheader('The response is ')
|
122 |
+
st.write(response)
|
123 |
+
else:
|
124 |
+
st.write("please upload the resume PDF and then click submit")
|
125 |
+
|
126 |
+
elif submit3:
|
127 |
+
if uploaded_file is not None:
|
128 |
+
pdf_content = input_pdf_setup(uploaded_file)
|
129 |
+
response = get_gemini_response(input_prompt3, pdf_content, input_JD)
|
130 |
+
st.subheader('The response is ')
|
131 |
+
st.write(response)
|
132 |
+
else:
|
133 |
+
st.write("please upload the resume PDF and then click submit")
|
134 |
+
|
135 |
+
elif submit4:
|
136 |
+
if uploaded_file is not None:
|
137 |
+
pdf_content = input_pdf_setup(uploaded_file)
|
138 |
+
response = get_gemini_response(input_prompt4, pdf_content, input_JD)
|
139 |
+
st.subheader('The response is ')
|
140 |
+
st.write(response)
|
141 |
+
else:
|
142 |
+
st.write("please upload the resume PDF and then click submit")
|
requirements.txt
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
google-generativeai
|
3 |
+
python-dotenv
|
4 |
+
langchain
|
5 |
+
PyPDF2
|
6 |
+
pdf2image
|
7 |
+
chromadb
|
8 |
+
langchain_google_genai
|