FUZZZZI commited on
Commit
bec06fd
1 Parent(s): 02beb85

Upload 2 files

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