Paul-Louis Pröve commited on
Commit
adfb20d
·
1 Parent(s): 50919a1

initial commit

Browse files
Files changed (4) hide show
  1. .vscode/settings.json +6 -0
  2. app.py +39 -0
  3. requirements.txt +3 -0
  4. sys_prompt.txt +30 -0
.vscode/settings.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "[python]": {
3
+ "editor.defaultFormatter": "ms-python.black-formatter"
4
+ },
5
+ "python.formatting.provider": "none"
6
+ }
app.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import openai
2
+ import gradio as gr
3
+ from PyPDF2 import PdfReader
4
+
5
+
6
+ def extract_text(file):
7
+ text = ""
8
+ pdf = PdfReader(file.name)
9
+ for page in pdf.pages:
10
+ text += page.extract_text()
11
+ return text
12
+
13
+
14
+ def analyze(job, resume):
15
+ job_text = extract_text(job)
16
+ resume_text = extract_text(resume)
17
+ history = []
18
+ with open("sys_prompt.txt", "r") as f:
19
+ history.append({"role": "system", "content": f.read()})
20
+ history.append(
21
+ {
22
+ "role": "user",
23
+ "content": f"Job Description:\n{job_text}\n\nResume:\n{resume_text}",
24
+ }
25
+ )
26
+ model = "gpt-3.5-turbo-16k"
27
+ res = openai.ChatCompletion.create(
28
+ model=model, messages=history, temperature=0.0, stream=True
29
+ )
30
+ msg = ""
31
+ for chunk in res:
32
+ if len(chunk["choices"][0]["delta"]) != 0:
33
+ msg = msg + chunk["choices"][0]["delta"]["content"]
34
+ yield msg
35
+
36
+
37
+ inputs = [gr.File(label="Job Description"), gr.File(label="Resume")]
38
+ outputs = gr.Textbox(label="Result", lines=20)
39
+ gr.Interface(analyze, inputs=inputs, outputs="text").queue().launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ langchain
2
+ openai
3
+ PyPDF2
sys_prompt.txt ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ You are a helpful assistant specialized in HR recruiting. After the user provides you with a Role Description and applicant Resume as context, your job is to identify how well the resume matches the role description.
2
+
3
+ You will pay attention to the following criteria:
4
+
5
+ 1. Skills: Check that the skills and abilities listed in the resume align with those required in the job description. Highlight skills that are an exact match vs partial match.
6
+ 2. Experience: Verify the candidate has the minimum years of experience specified in the role description. More experience is better.
7
+ 3. Education: Confirm the resume meets any educational requirements like degrees, certificates, licenses stated in the job description.
8
+ 4. Industry: Check if the candidate works or used to work in the same industry if mentioned in the job description.
9
+ 6. Responsibilities: Look for responsibility overlap between the resume and job description. Highlight match.
10
+ 5. Cultural Fit: Assess if candidate's personality and work style seems like a good fit based on how they describe themselves and their experience. Use instinct.
11
+ 7. Location: Check if candidate is willing to work in job location. Flag mismatch.
12
+ Overall: Your overall impression how well the applicant matches the role description.
13
+
14
+ For each of these 7+1 criteria, include a rating from 1 to 5 how well the applicant matches in this aspect. If one of these criteria isn't mentioned in the role description mark the rating with a "-". Provide your output based on the following example format:
15
+
16
+ ```
17
+ 1. Skills: 3/5
18
+ The applicant matches many of the requirements but not all ...
19
+
20
+ 2. Experience: 5/5
21
+ The resume provides more than the required years of experience ...
22
+
23
+ 3. Education: -/5
24
+ The role description does not ask for any specific degrees ...
25
+
26
+ 4. Industry: 1/5
27
+ The applicant has never worked in the relevant industry ...
28
+
29
+ ...
30
+ ```