Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -1,95 +1,55 @@
|
|
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
|
15 |
-
model=genai.GenerativeModel('gemini-pro
|
16 |
-
response=model.generate_content(
|
17 |
return response.text
|
18 |
|
19 |
-
def
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
st.set_page_config(page_title="ATS Resume EXpert")
|
44 |
-
st.header("ATS Tracking System")
|
45 |
-
input_text=st.text_area("Job Description: ",key="input")
|
46 |
-
uploaded_file=st.file_uploader("Upload your resume(PDF)...",type=["pdf"])
|
47 |
-
|
48 |
-
|
49 |
-
if uploaded_file is not None:
|
50 |
-
st.write("PDF Uploaded Successfully")
|
51 |
-
|
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("Percentage match")
|
58 |
-
|
59 |
-
input_prompt1 = """
|
60 |
-
You are an experienced Technical Human Resource Manager,your task is to review the provided resume against the job description.
|
61 |
-
Please share your professional evaluation on whether the candidate's profile aligns with the role.
|
62 |
-
Highlight the strengths and weaknesses of the applicant in relation to the specified job requirements.
|
63 |
"""
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
"""
|
70 |
|
71 |
-
|
72 |
-
if uploaded_file is not None:
|
73 |
-
pdf_content=input_pdf_setup(uploaded_file)
|
74 |
-
response=get_gemini_response(input_prompt1,pdf_content,input_text)
|
75 |
-
st.subheader("The Repsonse is")
|
76 |
-
st.write(response)
|
77 |
-
else:
|
78 |
-
st.write("Please uplaod the resume")
|
79 |
|
80 |
-
|
81 |
if uploaded_file is not None:
|
82 |
-
|
83 |
-
response=
|
84 |
-
st.subheader(
|
85 |
-
st.write(response)
|
86 |
-
else:
|
87 |
-
st.write("Please uplaod the resume")
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
|
|
|
|
1 |
|
|
|
|
|
2 |
import streamlit as st
|
|
|
|
|
|
|
|
|
3 |
import google.generativeai as genai
|
4 |
+
import os
|
5 |
+
import PyPDF2 as pdf
|
6 |
+
from dotenv import load_dotenv
|
7 |
+
import json
|
8 |
+
|
9 |
+
load_dotenv() ## load all our environment variables
|
10 |
|
11 |
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
12 |
|
13 |
+
def get_gemini_repsonse(input):
|
14 |
+
model=genai.GenerativeModel('gemini-pro')
|
15 |
+
response=model.generate_content(input)
|
16 |
return response.text
|
17 |
|
18 |
+
def input_pdf_text(uploaded_file):
|
19 |
+
reader=pdf.PdfReader(uploaded_file)
|
20 |
+
text=""
|
21 |
+
for page in range(len(reader.pages)):
|
22 |
+
page=reader.pages[page]
|
23 |
+
text+=str(page.extract_text())
|
24 |
+
return text
|
25 |
+
|
26 |
+
#Prompt Template
|
27 |
+
|
28 |
+
input_prompt="""
|
29 |
+
Hey Act Like a skilled or very experience ATS(Application Tracking System)
|
30 |
+
with a deep understanding of tech field,software engineering,data science ,data analyst
|
31 |
+
and big data engineer. Your task is to evaluate the resume based on the given job description.
|
32 |
+
You must consider the job market is very competitive and you should provide
|
33 |
+
best assistance for improving thr resumes. Assign the percentage Matching based
|
34 |
+
on Jd and
|
35 |
+
the missing keywords with high accuracy
|
36 |
+
resume:{text}
|
37 |
+
description:{jd}
|
38 |
+
|
39 |
+
I want the response in one single string having the structure
|
40 |
+
{{"JD Match":"%","MissingKeywords:[]","Profile Summary":""}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
"""
|
42 |
|
43 |
+
## streamlit app
|
44 |
+
st.title("Smart ATS")
|
45 |
+
st.text("Improve Your Resume ATS")
|
46 |
+
jd=st.text_area("Paste the Job Description")
|
47 |
+
uploaded_file=st.file_uploader("Upload Your Resume",type="pdf",help="Please uplaod the pdf")
|
48 |
|
49 |
+
submit = st.button("Submit")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
+
if submit:
|
52 |
if uploaded_file is not None:
|
53 |
+
text=input_pdf_text(uploaded_file)
|
54 |
+
response=get_gemini_repsonse(input_prompt)
|
55 |
+
st.subheader(response)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|