Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -1,85 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
-
import
|
3 |
-
import
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
st.
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
# st.write(f"**β
Matching Skills:** {', '.join(evaluation['matching_skills']) or 'None'}")
|
74 |
-
# st.write(f"**β Missing Skills:** {', '.join(evaluation['missing_skills']) or 'None'}")
|
75 |
-
st.write(f"**π‘ Improvement Skills (Required but Missing):** {', '.join(evaluation['improvement_skills']) or 'None'}")
|
76 |
-
|
77 |
-
|
78 |
-
if evaluation["matching_percentage"] > 70:
|
79 |
-
st.success("β
Resume is a strong match for the job description!")
|
80 |
-
elif evaluation["matching_percentage"] > 40:
|
81 |
-
st.warning("β οΈ Resume is a partial match for the job description.")
|
82 |
else:
|
83 |
-
st.
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
from dotenv import load_dotenv
|
3 |
+
|
4 |
+
load_dotenv()
|
5 |
+
import base64
|
6 |
import streamlit as st
|
7 |
+
import os
|
8 |
+
import io
|
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_cotent,prompt):
|
16 |
+
model=genai.GenerativeModel('gemini-pro-vision')
|
17 |
+
response=model.generate_content([input,pdf_content[0],prompt])
|
18 |
+
return response.text
|
19 |
+
|
20 |
+
def input_pdf_setup(uploaded_file):
|
21 |
+
if uploaded_file is not None:
|
22 |
+
## Convert the PDF to image
|
23 |
+
images=pdf2image.convert_from_bytes(uploaded_file.read())
|
24 |
+
|
25 |
+
first_page=images[0]
|
26 |
+
|
27 |
+
# Convert to bytes
|
28 |
+
img_byte_arr = io.BytesIO()
|
29 |
+
first_page.save(img_byte_arr, format='JPEG')
|
30 |
+
img_byte_arr = img_byte_arr.getvalue()
|
31 |
+
|
32 |
+
pdf_parts = [
|
33 |
+
{
|
34 |
+
"mime_type": "image/jpeg",
|
35 |
+
"data": base64.b64encode(img_byte_arr).decode() # encode to base64
|
36 |
+
}
|
37 |
+
]
|
38 |
+
return pdf_parts
|
39 |
+
else:
|
40 |
+
raise FileNotFoundError("No file uploaded")
|
41 |
+
|
42 |
+
## Streamlit App
|
43 |
+
|
44 |
+
st.set_page_config(page_title="ATS Resume EXpert")
|
45 |
+
st.header("ATS Tracking System")
|
46 |
+
input_text=st.text_area("Job Description: ",key="input")
|
47 |
+
uploaded_file=st.file_uploader("Upload your resume(PDF)...",type=["pdf"])
|
48 |
+
|
49 |
+
|
50 |
+
if uploaded_file is not None:
|
51 |
+
st.write("PDF Uploaded Successfully")
|
52 |
+
|
53 |
+
|
54 |
+
submit1 = st.button("Tell Me About the Resume")
|
55 |
+
|
56 |
+
#submit2 = st.button("How Can I Improvise my Skills")
|
57 |
+
|
58 |
+
submit3 = st.button("Percentage match")
|
59 |
+
|
60 |
+
input_prompt1 = """
|
61 |
+
You are an experienced Technical Human Resource Manager,your task is to review the provided resume against the job description.
|
62 |
+
Please share your professional evaluation on whether the candidate's profile aligns with the role.
|
63 |
+
Highlight the strengths and weaknesses of the applicant in relation to the specified job requirements.
|
64 |
+
"""
|
65 |
+
|
66 |
+
input_prompt3 = """
|
67 |
+
You are an skilled ATS (Applicant Tracking System) scanner with a deep understanding of data science and ATS functionality,
|
68 |
+
your task is to evaluate the resume against the provided job description. give me the percentage of match if the resume matches
|
69 |
+
the job description. First the output should come as percentage and then keywords missing and last final thoughts.
|
70 |
+
"""
|
71 |
+
|
72 |
+
if submit1:
|
73 |
+
if uploaded_file is not None:
|
74 |
+
pdf_content=input_pdf_setup(uploaded_file)
|
75 |
+
response=get_gemini_response(input_prompt1,pdf_content,input_text)
|
76 |
+
st.subheader("The Repsonse is")
|
77 |
+
st.write(response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
else:
|
79 |
+
st.write("Please uplaod the resume")
|
80 |
+
|
81 |
+
elif submit3:
|
82 |
+
if uploaded_file is not None:
|
83 |
+
pdf_content=input_pdf_setup(uploaded_file)
|
84 |
+
response=get_gemini_response(input_prompt3,pdf_content,input_text)
|
85 |
+
st.subheader("The Repsonse is")
|
86 |
+
st.write(response)
|
87 |
+
else:
|
88 |
+
st.write("Please uplaod the resume")
|
89 |
+
|