nikhil061307 commited on
Commit
0e2fdb8
·
verified ·
1 Parent(s): a3ee3d8

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +18 -0
  2. app.py +120 -0
  3. requirements.txt +5 -0
Dockerfile ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use the official Python base image
2
+ FROM python:3.10-slim
3
+
4
+ # Install system dependencies
5
+ RUN apt-get update && apt-get install -y poppler-utils
6
+
7
+ # Install Python dependencies
8
+ COPY requirements.txt .
9
+ RUN pip install --no-cache-dir -r requirements.txt
10
+
11
+ # Copy the rest of your app's code
12
+ COPY . /app
13
+
14
+ # Set the working directory
15
+ WORKDIR /app
16
+
17
+ # Command to run the app
18
+ CMD ["streamlit", "run", "app.py"]
app.py ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
13
+
14
+ def get_gemini_response(input,pdf_cotent,prompt):
15
+ model=genai.GenerativeModel('gemini-pro-vision')
16
+ response=model.generate_content([input,pdf_content[0],prompt])
17
+ return response.text
18
+
19
+
20
+ def input_pdf_setup(uploaded_file):
21
+ if uploaded_file is not None:
22
+ ## Convert the PDF to image
23
+ images=pdf2image.convert_from_bytes(uploaded_file.read())
24
+
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="ATS Resume EXpert")
45
+ st.header("ATS Tracking System")
46
+ input_text=st.text_area("Job Description: ",key="input")
47
+ uploaded_file=st.file_uploader("Upload your resume(PDF)...",type=["pdf"])
48
+
49
+
50
+ if uploaded_file is not None:
51
+ st.write('PDF Uploaded Successfully')
52
+
53
+ submit1=st.button('Tell Me About the Resume')
54
+
55
+ submit2=st.button('How Can I Improvise my skills')
56
+
57
+ submit3=st.button('What are the Keywords That are Missing')
58
+
59
+ submit4=st.button('Percentage Match')
60
+
61
+ input_prompt1='''
62
+ You are an experienced Technical Human Resource Manager,your task is to review the provided resume against the job description.
63
+ Please share your professional evaluation on whether the candidate's profile aligns with the role.
64
+ Highlight the strengths and weaknesses of the applicant in relation to the specified job requirements.'''
65
+
66
+
67
+ input_prompt2='''ou are a skilled Application Tracking System (ATS) specialized in scanning resumes and providing recommendations
68
+ for skill improvement based on a given job description. Here is the job description and the resume. Please analyze the resume and
69
+ provide key points on how the candidate can improve their skills to better match the job description.'''
70
+
71
+
72
+ input_prompt3='''You are a skilled Application Tracking System (ATS) specialized in scanning resumes and identifying missing keywords
73
+ or skills based on a given job description. Here is the job description and the resume. Please analyze the resume and provide a list
74
+ of missing words or skills.'''
75
+
76
+ input_prompt4 = """
77
+ You are an skilled ATS (Applicant Tracking System) scanner with a deep understanding of data science and ATS functionality,
78
+ your task is to evaluate the resume against the provided job description. give me the percentage of match if the resume matches
79
+ the job description. First the output should come as percentage and then keywords missing and last final thoughts.
80
+ """
81
+
82
+ if submit1:
83
+ if uploaded_file is not None:
84
+ pdf_content=input_pdf_setup(uploaded_file)
85
+ response=get_gemini_response(input_prompt1,pdf_content,input_text)
86
+ st.subheader("The Repsonse is")
87
+ st.write(response)
88
+ else:
89
+ st.write("Please uplaod the resume")
90
+
91
+
92
+ st.write("Please uplaod the resume")
93
+
94
+ elif submit2:
95
+ if uploaded_file is not None:
96
+ pdf_content=input_pdf_setup(uploaded_file)
97
+ response=get_gemini_response(input_prompt2,pdf_content,input_text)
98
+ st.subheader("The Repsonse is")
99
+ st.write(response)
100
+ else:
101
+ st.write("Please uplaod the resume")
102
+
103
+ elif submit3:
104
+ if uploaded_file is not None:
105
+ pdf_content=input_pdf_setup(uploaded_file)
106
+ response=get_gemini_response(input_prompt3,pdf_content,input_text)
107
+ st.subheader("The Repsonse is")
108
+ st.write(response)
109
+ else:
110
+ st.write("Please uplaod the resume")
111
+
112
+
113
+ elif submit4:
114
+ if uploaded_file is not None:
115
+ pdf_content=input_pdf_setup(uploaded_file)
116
+ response=get_gemini_response(input_prompt4,pdf_content,input_text)
117
+ st.subheader("The Repsonse is")
118
+ st.write(response)
119
+ else:
120
+ st.write("Please uplaod the resume")
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ langchain
2
+ google-generativeai
3
+ streamlit
4
+ python-dotenv
5
+ pdf2image