Spaces:
Running
Running
Commit
•
bd2b4a2
1
Parent(s):
45bfcc4
Requirement modified
Browse files- ats.py +0 -96
- requirements.txt +1 -4
ats.py
DELETED
@@ -1,96 +0,0 @@
|
|
1 |
-
from dotenv import load_dotenv
|
2 |
-
|
3 |
-
load_dotenv()
|
4 |
-
import base64
|
5 |
-
import streamlit as st
|
6 |
-
import os
|
7 |
-
import io
|
8 |
-
from PIL import Image
|
9 |
-
import pdf2image
|
10 |
-
import google.generativeai as genai
|
11 |
-
|
12 |
-
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
13 |
-
|
14 |
-
def get_gemini_response(input,pdf_cotent,prompt):
|
15 |
-
model=genai.GenerativeModel('gemini-pro-vision')
|
16 |
-
response=model.generate_content([input,pdf_content[0],prompt])
|
17 |
-
return response.text
|
18 |
-
|
19 |
-
def input_pdf_setup(uploaded_file):
|
20 |
-
if uploaded_file is not None:
|
21 |
-
## Convert the PDF to image
|
22 |
-
images=pdf2image.convert_from_bytes(uploaded_file.read(), poppler_path=r'C:\Program Files (x86)\poppler\Library\bin')
|
23 |
-
|
24 |
-
first_page=images[0]
|
25 |
-
|
26 |
-
# Convert to bytes
|
27 |
-
img_byte_arr = io.BytesIO()
|
28 |
-
first_page.save(img_byte_arr, format='JPEG')
|
29 |
-
img_byte_arr = img_byte_arr.getvalue()
|
30 |
-
|
31 |
-
pdf_parts = [
|
32 |
-
{
|
33 |
-
"mime_type": "image/jpeg",
|
34 |
-
"data": base64.b64encode(img_byte_arr).decode() # encode to base64
|
35 |
-
}
|
36 |
-
]
|
37 |
-
return pdf_parts
|
38 |
-
else:
|
39 |
-
raise FileNotFoundError("No file uploaded")
|
40 |
-
|
41 |
-
## Streamlit App
|
42 |
-
|
43 |
-
st.set_page_config(page_title="ATS Resume EXpert")
|
44 |
-
st.header("ATS Tracking System")
|
45 |
-
input_text=st.text_area("Job Description: ",key="input")
|
46 |
-
uploaded_file=st.file_uploader("Upload your resume(PDF)...",type=["pdf"])
|
47 |
-
|
48 |
-
|
49 |
-
if uploaded_file is not None:
|
50 |
-
st.write("PDF Uploaded Successfully")
|
51 |
-
|
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 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
@@ -9,7 +9,4 @@ python-dotenv
|
|
9 |
SpeechRecognition
|
10 |
PyAudio
|
11 |
pdfplumber
|
12 |
-
python-docx
|
13 |
-
|
14 |
-
|
15 |
-
https://github.com/oschwartz10612/poppler-windows/releases/download/v24.02.0-0/Release-24.02.0-0.zip
|
|
|
9 |
SpeechRecognition
|
10 |
PyAudio
|
11 |
pdfplumber
|
12 |
+
python-docx
|
|
|
|
|
|