EswarP commited on
Commit
4f7c24d
1 Parent(s): 4a93851

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +72 -0
app.py ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ from dotenv import load_dotenv
3
+ import streamlit as st
4
+ import google.generativeai as genai
5
+ from PyPDF2 import PdfReader
6
+
7
+ ## load the environment variables
8
+ load_dotenv()
9
+
10
+ ## configure the google with apikey
11
+ genai.configure(api_key=os.getenv('GOOGLE_API_KEY'))
12
+
13
+ #to get response from geminipro
14
+ def get_response_gemini(input):
15
+ model=genai.GenerativeModel('gemini-pro')
16
+ response=model.generate_content(input)
17
+ return response.text
18
+
19
+ ## to read pdf data to text
20
+ def read_pdf_text(uploaded_file):
21
+ if uploaded_file is not None:
22
+ reader=PdfReader(uploaded_file)
23
+ text = ''
24
+ for page_num in range(len(reader.pages)):
25
+ page = reader.pages[page_num]
26
+ text += page.extract_text()
27
+ return text
28
+
29
+ # for creating prompt template with dynamic input fields
30
+
31
+ input_prompt=["""
32
+ You are an expert hr in Applicant Tracking System (ATS) for a resume application. The ATS is specialized in handling resumes for candidates with expertise in full-stack development, DevOps, data science, and data analytics.
33
+
34
+ Inputs:
35
+
36
+ {text}: This input represents the resume of a candidate applying for a job.
37
+ {jd}: This input represents the job description provided by the employer.
38
+
39
+ Objective:
40
+
41
+ Design a system that can analyze the resume text and the job description to determine the extent to which the candidate's skills match the requirements of the job. The system should utilize natural language processing techniques to identify relevant skills and experience related to full-stack development, DevOps, data science, and data analytics.
42
+ Assign the matching score with respect to the job description and give the missing words
43
+
44
+ Guidelines:
45
+
46
+ Consider using keyword matching, named entity recognition, or other NLP techniques to identify relevant skills and experience in both the resume text and the job description.
47
+ Assign weights or scores to different skills and experiences based on their relevance to the job requirements.
48
+ Provide a summary or ranking of the candidate's suitability for the job based on the analysis of the resume text and the job description.
49
+ Output:
50
+
51
+ The system output should be in the form of below
52
+ 1. a summary of the candidate's suitability for the job, highlighting the match between the candidate's skills and experiences and the requirements of the job.
53
+ 2. {{JD Matching Score:'%'}}
54
+ 3. {{Missing Keywords:[]}}
55
+ """]
56
+
57
+ ## Streamlit app
58
+ st.set_page_config(page_title="ATS APP for Resumes")
59
+ st.header('ATS using Gemini Pro')
60
+ jd=st.text_area('Enter the job description: ',key='jd')
61
+ upload_file=st.file_uploader('Upload resume: ',type='pdf')
62
+
63
+ submit=st.button('Validate')
64
+
65
+ if submit:
66
+ if upload_file is not None:
67
+ text=read_pdf_text(upload_file)
68
+ response=get_response_gemini(input_prompt)
69
+ st.subheader(response)
70
+ else:
71
+ st.subheader('Please upload the resume')
72
+