-
Notifications
You must be signed in to change notification settings - Fork 0
/
ats.py
75 lines (59 loc) · 2.47 KB
/
ats.py
1
2
3
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
from dotenv import load_dotenv
load_dotenv()
import streamlit as st
import os
import PyPDF2 as pdf
import google.generativeai as genai
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
def get_gemini_response(input):
model=genai.GenerativeModel('gemini-pro')
response=model.generate_content(input)
return response.text
def input_pdf_text(uploaded_file):
if uploaded_file is not None:
## Convert the PDF to text
reader=pdf.PdfReader(uploaded_file)
text=''
for page in reader.pages:
text+=page.extract_text()
return text
else:
raise FileNotFoundError("No file uploaded")
## Streamlit App
st.set_page_config(page_title="ATS Resume EXpert")
st.header("ATS Tracking System")
jd=st.text_area("Job Description: ",key="input")
uploaded_file=st.file_uploader("Upload your resume(PDF)...",type=["pdf"])
if uploaded_file is not None:
st.write("PDF Uploaded Successfully")
submit1 = st.button("Tell Me About the Resume")
#submit2 = st.button("How Can I Improvise my Skills")
submit3 = st.button("Percentage match")
input_prompt1 = """
You are an experienced Technical Human Resource Manager,your task is to review the provided resume against the job description.
Please share your professional evaluation on whether the candidate's resume:{text} matches with the role job description:{jd}.
Highlight the strengths and weaknesses of the applicant in relation to the specified job requirements.
"""
input_prompt3 = """
You are an skilled ATS (Applicant Tracking System) scanner with a deep understanding of data science and ATS functionality,
your task is to evaluate the resume against the provided job description. give me the percentage of match if the resume matches
the job description. First the output should come as percentage and then keywords missing and last final thoughts.
resume:{text}
description:{jd}
"""
if submit1:
if uploaded_file is not None:
text=input_pdf_text(uploaded_file)
response=get_gemini_response(input_prompt1)
st.subheader("The Repsonse is")
st.write(response)
else:
st.write("Please uplaod the resume")
elif submit3:
if uploaded_file is not None:
pdf_content=input_pdf_text(uploaded_file)
response=get_gemini_response(input_prompt3)
st.subheader("The Repsonse is")
st.write(response)
else:
st.write("Please uplaod the resume")