yourownvibhore commited on
Commit
97a66d3
·
verified ·
1 Parent(s): d0aef64

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +77 -0
  2. requirements.txt +8 -0
app.py ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dotenv import load_dotenv
2
+ load_dotenv()
3
+ import streamlit as st
4
+ import os
5
+ import google.generativeai as genai
6
+ from PIL import Image
7
+ import pdf2image
8
+ import io
9
+ import base64
10
+
11
+ genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
12
+ # load gemini model
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
+ def input_pdf_setup(uploaded_file):
18
+ if uploaded_file is not None:
19
+ images=pdf2image.convert_from_bytes(uploaded_file.read(),poppler_path=r'C:\Program Files (x86)\poppler\Library\bin')
20
+ first_page=images[0]
21
+ img_byte_arr=io.BytesIO()
22
+ first_page.save(img_byte_arr,format="JPEG")
23
+ img_byte_arr = img_byte_arr.getvalue()
24
+
25
+ pdf_parts=[
26
+ {
27
+ "mime_type":"image/jpeg",
28
+ "data": base64.b64encode(img_byte_arr).decode()
29
+ }
30
+
31
+ ]
32
+ return pdf_parts
33
+ else:
34
+ raise FileNotFoundError("File not found")
35
+
36
+
37
+
38
+ st.set_page_config(page_title="ATS resume checker", page_icon="🔮")
39
+ st.title("Resume checker")
40
+ input = st.text_area("give job description",key="input")
41
+ uploaded_file = st.file_uploader("Upload your resume(pdf)", type=["pdf"])
42
+ if uploaded_file is not None:
43
+ st.write("File uploaded successfully")
44
+
45
+ submit1=st.button("Tell me about the resume")
46
+
47
+ # submit2=st.button("How can I improve my skills")
48
+
49
+ submit3=st.button("percentage of matching with job description")
50
+
51
+ input_prompt1 = """
52
+ You are an experienced Technical Human Resource Manager,your task is to review the provided resume against the job description.
53
+ Please share your professional evaluation on whether the candidate's profile aligns with the role.
54
+ Highlight the strengths and weaknesses of the applicant in relation to the specified job requirements.
55
+ """
56
+
57
+ input_prompt3 = """
58
+ You are an skilled ATS (Applicant Tracking System) scanner with a deep understanding of data science and ATS functionality,
59
+ your task is to evaluate the resume against the provided job description. give me the percentage of match if the resume matches
60
+ the job description. First the output should come as percentage and then keywords missing and last final thoughts.
61
+ """
62
+ if submit1:
63
+ if uploaded_file is not None:
64
+ pdf_content=input_pdf_setup(uploaded_file)
65
+ response=get_gemini_response(input,pdf_content,input_prompt1)
66
+ st.subheader("The response is")
67
+ st.write(response)
68
+ else:
69
+ st.write("Please upload the resume")
70
+ elif submit3:
71
+ if uploaded_file is not None:
72
+ pdf_content=input_pdf_setup(uploaded_file)
73
+ response=get_gemini_response(input,pdf_content,input_prompt3)
74
+ st.subheader("The response is")
75
+ st.write(response)
76
+ else:
77
+ st.write("Please upload the resume")
requirements.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ streamlit
2
+ google-generativeai
3
+ python-dotenv
4
+ langchain
5
+ PyPDF2
6
+ faiss-cpu
7
+ langchain_google_genai
8
+ pdf2image