Dilipk commited on
Commit
c909dfb
·
verified ·
1 Parent(s): 7c61783
Files changed (2) hide show
  1. ats_gemini.py +87 -0
  2. requirements.txt +4 -0
ats_gemini.py ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
13
+ genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
14
+
15
+ def get_gemini_response(input,pdf_content,prompt):
16
+ model=genai.GenerativeModel('gemini-1.5-flash')
17
+ response=model.generate_content([input,pdf_content[0],prompt])
18
+ return response.text
19
+
20
+
21
+ def input_pdf_setup(uploaded_file):
22
+ if uploaded_file is not None:
23
+ images=pdf2image.convert_from_bytes(uploaded_file.read())
24
+
25
+ first_page=images[0]
26
+
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()
35
+ }
36
+ ]
37
+ return pdf_parts
38
+ else:
39
+ raise FileNotFoundError("No file uploaded")
40
+
41
+
42
+ st.set_page_config(page_title="ATS Resume EXpert")
43
+ st.header("ATS Tracking System")
44
+ input_text=st.text_area("Job Description: ",key="input")
45
+ uploaded_file=st.file_uploader("Upload your resume(PDF)...",type=["pdf"])
46
+
47
+
48
+ if uploaded_file is not None:
49
+ st.write("PDF Uploaded Successfully")
50
+
51
+
52
+ submit1 = st.button("Tell Me About the Resume")
53
+
54
+ submit3 = st.button("Percentage match")
55
+
56
+ input_prompt1 = """
57
+ You are an experienced Technical Human Resource Manager,your task is to review the provided resume against the job description.
58
+ Please share your professional evaluation on whether the candidate's profile aligns with the role.
59
+ Highlight the strengths and weaknesses of the applicant in relation to the specified job requirements.
60
+ """
61
+
62
+ input_prompt3 = """
63
+ You are an skilled ATS (Applicant Tracking System) scanner with a deep understanding of data science and ATS functionality,
64
+ your task is to evaluate the resume against the provided job description. give me the percentage of match if the resume matches
65
+ the job description. First the output should come as percentage and then keywords missing and last final thoughts.
66
+ """
67
+
68
+ if submit1:
69
+ if uploaded_file is not None:
70
+ pdf_content=input_pdf_setup(uploaded_file)
71
+ response=get_gemini_response(input_prompt1,pdf_content,input_text)
72
+ st.subheader("The Repsonse is")
73
+ st.write(response)
74
+ else:
75
+ st.write("Please uplaod the resume")
76
+
77
+ elif submit3:
78
+ if uploaded_file is not None:
79
+ pdf_content=input_pdf_setup(uploaded_file)
80
+ response=get_gemini_response(input_prompt3,pdf_content,input_text)
81
+ st.subheader("The Repsonse is")
82
+ st.write(response)
83
+ else:
84
+ st.write("Please uplaod the resume")
85
+
86
+
87
+
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ streamlit
2
+ google-generativeai
3
+ python-dotenv
4
+ pdf2image