kilachei commited on
Commit
76222f7
1 Parent(s): ae06c38

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +143 -0
  2. requirements.txt +10 -0
app.py ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dotenv import load_dotenv
2
+
3
+ load_dotenv()
4
+
5
+ import streamlit as st
6
+ import os
7
+ import io
8
+ import base64
9
+ from PIL import Image
10
+ import pdf2image
11
+ from PyPDF2 import PdfReader
12
+ import google.generativeai as genai
13
+ from langchain.text_splitter import RecursiveCharacterTextSplitter
14
+ from langchain.vectorstores import FAISS, Chroma
15
+ from langchain.chains.question_answering import load_qa_chain
16
+ from langchain.embeddings.openai import OpenAIEmbeddings
17
+ from langchain.prompts import PromptTemplate
18
+ from openai import OpenAI
19
+
20
+
21
+ client = OpenAI()
22
+
23
+
24
+ #read pdf
25
+ def get_pdf_text(pdf_docs):
26
+ text=""
27
+ for pdf in pdf_docs:
28
+ pdf_reader= PdfReader(pdf)
29
+ for page in pdf_reader.pages:
30
+ text+= page.extract_text()
31
+ return text
32
+
33
+ #divide pdf text into overlapping chunks
34
+ def get_text_chunks(text):
35
+ text_splitter = RecursiveCharacterTextSplitter(chunk_size = 30, chunk_overlap=5)
36
+ chunks = text_splitter.split_text(text)
37
+ return chunks
38
+
39
+ #convert chunks to embeddings
40
+ def get_vector_store(text_chunks):
41
+ embeddings = OpenAIEmbeddings()
42
+ vector_store = FAISS.from_texts(text_chunks, embedding=embeddings)
43
+ #vector stores can be stored locally or even in a database
44
+
45
+ vector_store.save_local("faiss_index")
46
+
47
+ def get_openai_response(prompt):
48
+ completion = client.chat.completions.create(
49
+ model="gpt-3.5-turbo", # or other available engines
50
+ messages=[
51
+ {"role": "user", "content": prompt}
52
+ ]
53
+ )
54
+ return completion.choices[0].message.content
55
+
56
+
57
+ def main():
58
+ st.set_page_config(page_title="Personal ATS")
59
+ st.header("ATS Keyword Matching")
60
+ input_text_title = st.text_area("Job Title: ", key="inpu_title")
61
+ input_text_jd = st.text_area("Job Description: ", key="input_jd")
62
+
63
+ pdf_docs = st.file_uploader("Upload Resume (pdf)", accept_multiple_files=True)
64
+
65
+
66
+ submit1 = st.button("Resume evaluation against job role")
67
+ submit2 = st.button("Percentage Match")
68
+ submit3 = st.button("Ideal Resume")
69
+
70
+ input_prompt1 = """
71
+ You are an experienced Technical Human Resource Manager experienced in the field of {}, your task is to review the provided resume against the job description.
72
+ Please share your professional evaluation on whether the candidate's profile aligns with the role.
73
+ Highlight the strengths and weaknesses of the applicant in relation to the specified job requirements.
74
+ Resume: {}
75
+ Job Description: {}
76
+ """
77
+
78
+ input_prompt2 = """
79
+ You are an skilled ATS (Applicant Tracking System) scanner with a deep understanding in the field of {},
80
+ your task is to evaluate the resume against the provided job description. You should output first the percentage of match between the resume and
81
+ the job description, followed by keywords matching, keywords missing, specific changes for resume to reach matching percentage
82
+ of above 85 and lastly your final thoughts.
83
+ Resume: {}
84
+ Job Description: {}
85
+ """
86
+
87
+ input_prompt3_alternate = """
88
+ You are an expert at making resumes for the job role of {}. Your task is to make an ideal resume for the job description I give you using ONLY the following three sections and then give me a keyword match percentage between the created resume and the job description at the end:
89
+ 1. The skills section with comma separated technical tools and frameworks.
90
+ 2. The work experience section with 3 job roles.
91
+ 3. Projects section with six ADVANCED projects and you have to
92
+ make up your own projects from imagination that would use the same
93
+ tech stack specified in the job description with minimum overlap of tech stack between the projects.
94
+ Each project will have a project title followed by two bullet points.
95
+ First bullet point is the project description
96
+ and the second bullet point is the tech stack used to make the project.
97
+
98
+ You also have to give me exact value for keyword match percentage between the resume you created and the job description.
99
+ Job Description: {}
100
+ """
101
+ input_prompt3 = """
102
+ Write a resume based on the following job description for the {} position and include bullet point achievements that show impact and metrics.
103
+ It should include ONLY these section:
104
+ 1. The skills section with comma separated technical tools and frameworks.
105
+ 2. The work experience section with 3 job roles.
106
+ 3. Projects section with six ADVANCED projects. Each project will have a project title followed by two bullet points. First bullet point is the project description and the second bullet point is the tech stack used to make the project. Use numbers that show impact and metrics
107
+ Job description: {}
108
+ """
109
+
110
+ if submit1:
111
+ if pdf_docs is not None:
112
+ pdf_content = get_pdf_text(pdf_docs)
113
+ prompt = input_prompt1.format(input_text_title, pdf_content, input_text_jd)
114
+ response = get_openai_response(prompt)
115
+ st.subheader("Response: ")
116
+ st.write(response)
117
+ else:
118
+ st.write("Please upload resume")
119
+
120
+ elif submit2:
121
+ if pdf_docs is not None:
122
+ pdf_content = get_pdf_text(pdf_docs)
123
+ prompt = input_prompt2.format(input_text_title, pdf_content, input_text_jd)
124
+ response = get_openai_response(prompt)
125
+ st.subheader("Response: ")
126
+ st.write(response)
127
+ else:
128
+ st.write("Please upload resume")
129
+
130
+ elif submit3:
131
+ if input_text_jd is not None:
132
+ pdf_content = get_pdf_text(pdf_docs)
133
+ prompt = input_prompt3.format(input_text_title, input_text_jd)
134
+ response = get_openai_response(prompt)
135
+ st.subheader("Response: ")
136
+ st.write(response)
137
+ else:
138
+ st.write("Please upload resume")
139
+
140
+
141
+
142
+ if __name__ == "__main__":
143
+ main()
requirements.txt ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ streamlit
2
+ google-generativeai
3
+ python-dotenv
4
+ pdf2image
5
+ langchain
6
+ PyPDF2
7
+ chromadb
8
+ faiss-cpu
9
+ langchain_google_genai
10
+ openai