Saurabhgk18 commited on
Commit
ff2a5e5
1 Parent(s): 974b9a8

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +183 -0
  2. packages.txt +1 -0
  3. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dotenv import load_dotenv
2
+ import streamlit as st
3
+ import os
4
+ from PIL import Image
5
+ import io
6
+ import pdf2image
7
+ import base64
8
+ import google.generativeai as genai
9
+
10
+
11
+ load_dotenv() ## load all our environment variables
12
+
13
+ genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
14
+
15
+ def response(input, pdf, prompt):
16
+ model = genai.GenerativeModel('gemini-pro-vision')
17
+ response = model.generate_content([input, pdf[0], prompt])
18
+ return response.text
19
+
20
+ def input_pdf_setup(uploaded_file):
21
+ if uploaded_file is not None:
22
+ # Convert PDF to image
23
+ images = pdf2image.convert_from_bytes(uploaded_file.read())
24
+ # Take the first page for simplicity, or loop through images for all pages
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="Resume Checker", layout='wide')
45
+ header_style = """
46
+ <style>
47
+ .header {
48
+ text-align: center;
49
+ # padding: -20em;
50
+ margin: -2em;
51
+ }
52
+ </style>
53
+ """
54
+
55
+ # Display the custom style
56
+ st.markdown(header_style, unsafe_allow_html=True)
57
+ st.markdown("<h1 class='header'>ATS Resume Checker System</h1>", unsafe_allow_html=True)
58
+ st.divider()
59
+ # Create two columns
60
+ col1, col2 = st.columns(2)
61
+
62
+ # Text area in the first column
63
+ input_text = col1.text_area("Company's Job Description", key="input", height=250)
64
+
65
+ # File uploader in the second column
66
+ uploaded_file = col2.file_uploader("PDF Resume Here...", type=['pdf'])
67
+ pdf_content = ""
68
+
69
+ if uploaded_file is not None:
70
+ st.write("PDF Uploaded Successfully")
71
+
72
+ col1, col2, col3, col4, col5, col6 = st.columns(6)
73
+
74
+
75
+ submit1 = col2.button("Tell Me About the Resume")
76
+
77
+ submit2 = col3.button("Improvise my Resume")
78
+
79
+ submit3 = col4.button("Missing Keywords")
80
+
81
+ submit4 = col5.button("Percentage match")
82
+
83
+ c1, c2, c3 = st.columns(3)
84
+ sus = c2.button('Improve Experience content writing...')
85
+
86
+ # special_prompt = """
87
+ # You are an experienced Technical Human Resource Manager,your task is to review the provided resume against the job description.
88
+ # please Check all the spelling mistakes and suggest more impactful way to write Candidate's experience and using action verbs and more impactful,
89
+ # way to write project descriptions.
90
+ # """
91
+
92
+ special_prompt = """
93
+ You are an experienced Technical Human Resource Manager, your task is to review the provided resume against the job description.
94
+ Please edit and write down candidate's experience and make it more impact full.
95
+ .
96
+ """
97
+
98
+
99
+ input_prompt1 = """
100
+ You are an experienced Technical Human Resource Manager,your task is to review the provided resume against the job description.
101
+ Please share your professional evaluation on whether the candidate's profile aligns with the role.
102
+ Highlight the strengths and weaknesses of the applicant in relation to the specified job requirements.
103
+ """
104
+
105
+ input_prompt2 = """
106
+ You are an Technical Human Resource Manager with expertise in data science,
107
+ your role is to scrutinize the resume in light of the job description provided.
108
+ Share your insights on the candidate's suitability for the role from an HR perspective.
109
+ Additionally, offer advice on enhancing the candidate's skills and identify areas where improvement is needed.
110
+ """
111
+
112
+ input_prompt3 = """
113
+ You are an skilled ATS (Applicant Tracking System) scanner with a deep understanding of data science and ATS functionality,
114
+ your task is to evaluate the resume against the provided job description. As a Human Resource manager,
115
+ assess the compatibility of the resume with the role. Give me what are the keywords that are missing
116
+ Also, provide recommendations for enhancing the candidate's skills and identify which areas require further development.
117
+ """
118
+ input_prompt4 = """
119
+ You are an skilled ATS (Applicant Tracking System) scanner with a deep understanding of data science and ATS functionality,
120
+ your task is to evaluate the resume against the provided job description. give me the percentage of match if the resume matches
121
+ the job description. First the output should come as percentage and then keywords missing and last final thoughts.
122
+ """
123
+
124
+ if sus:
125
+ if uploaded_file is not None:
126
+ pdf_content = input_pdf_setup(uploaded_file)
127
+
128
+ response = response(
129
+ input = input_text,
130
+ pdf = pdf_content,
131
+ prompt = special_prompt
132
+ )
133
+
134
+ st.subheader("The Repsonse is")
135
+ st.write(response)
136
+ else:
137
+ st.write("Please uplaod the resume")
138
+
139
+
140
+ if submit1:
141
+ if uploaded_file is not None:
142
+ pdf_content = input_pdf_setup(uploaded_file)
143
+ response = response(input_prompt1, pdf_content, input_text)
144
+
145
+ with st.container():
146
+ st.subheader("The Response is")
147
+ st.write(response)
148
+ else:
149
+ st.write("Please upload a PDF file to proceed.")
150
+
151
+
152
+
153
+
154
+ elif submit2:
155
+ if uploaded_file is not None:
156
+ pdf_content = input_pdf_setup(uploaded_file)
157
+ response = response(input_prompt2, pdf_content, input_text)
158
+ st.subheader("The Response is")
159
+ st.write(response)
160
+ else:
161
+ st.write("Please upload a PDF file to proceed.")
162
+
163
+ elif submit3:
164
+ if uploaded_file is not None:
165
+ pdf_content = input_pdf_setup(uploaded_file)
166
+ response = response(input_prompt3, pdf_content, input_text)
167
+ st.subheader("The Response is")
168
+ st.write(response)
169
+ else:
170
+ st.write("Please upload a PDF file to proceed.")
171
+
172
+ elif submit4:
173
+ if uploaded_file is not None:
174
+ pdf_content = input_pdf_setup(uploaded_file)
175
+ response = response(input_prompt4, pdf_content, input_text)
176
+ st.subheader("The Response is")
177
+ st.write(response)
178
+ else:
179
+ st.write("Please upload a PDF file to proceed.")
180
+
181
+
182
+ st.markdown("---")
183
+ st.caption("This is just a beta release...")
packages.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ poppler-utils
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ streamlit
2
+ google-generativeai
3
+ python-dotenv
4
+ pdf2image