srinidhidevaraj commited on
Commit
29e2486
·
verified ·
1 Parent(s): 6d8d9f0

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +62 -0
app.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ from dotenv import load_dotenv
3
+ from langchain.prompts import PromptTemplate
4
+ load_dotenv()
5
+ from PyPDF2 import PdfReader
6
+ import streamlit as st
7
+ import os
8
+ import google.generativeai as genai
9
+ import re
10
+ # genai.configure(api_key=os.getenv("gkey2"))
11
+ import PIL.Image
12
+ import pdf2image
13
+
14
+
15
+ ###approach######
16
+ # 1.pdf-->image->api-->response [ats_1.0]
17
+ # 2.pdf-->text-->api-->response [ats_2.0]
18
+
19
+ def get_pdf_text(pdf_doc):
20
+ text=""
21
+
22
+ pdf_reader=PdfReader(pdf_doc)
23
+ for page in pdf_reader.pages:
24
+ text+=page.extract_text()
25
+ return text
26
+
27
+ def get_gemini_response(input):
28
+ model=genai.GenerativeModel('gemini-pro')
29
+ response=model.generate_content(input)
30
+ return response.text
31
+
32
+ def prompt_temp(text,jd):
33
+ input_prompt= [
34
+ f"""
35
+ Hey Act Like a skilled or very experience ATS(Application Tracking System)
36
+ with a deep understanding of tech field,software engineering,data science ,data analyst
37
+ and big data engineer. Your task is to evaluate the resume based on the given job description.
38
+ You must consider the job market is very competitive and you should provide
39
+ best assistance for improving thr resumes. Assign the percentage Matching based
40
+ on Jd and
41
+ the missing keywords with high accuracy
42
+ resume:{text}
43
+ description:{jd}
44
+
45
+ I want the response in one single string having the structure
46
+ {{"JD Match":"%",'\n' "MissingKeywords:[]",'\n' "Profile Summary":""}}
47
+
48
+ """]
49
+ return input_prompt
50
+
51
+ st.title("Smart ATS")
52
+ st.text("Improve Your Resume ATS")
53
+ jd=st.text_area("Paste the Job Description")
54
+ uploaded_file=st.file_uploader("Upload Your Resume",type="pdf",help="Please uplaod the pdf")
55
+
56
+ submit = st.button("Submit")
57
+ if submit:
58
+ if uploaded_file is not None:
59
+ text=get_pdf_text(uploaded_file)
60
+ input_prompt=prompt_temp(text,jd)
61
+ response=get_gemini_response(input_prompt)
62
+ st.write(response)