Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from dotenv import load_dotenv
|
2 |
+
load_dotenv()
|
3 |
+
|
4 |
+
import streamlit as st
|
5 |
+
import google.generativeai as genai
|
6 |
+
import os
|
7 |
+
import PyPDF2 as pdf
|
8 |
+
import docx
|
9 |
+
|
10 |
+
genai.configure(api_key=os.getenv("GOOGLE_API_KEY"))
|
11 |
+
|
12 |
+
def get_gemini_response(input):
|
13 |
+
model = genai.GenerativeModel("gemini-pro")
|
14 |
+
response = model.generate_content(input)
|
15 |
+
return response.text # Assuming `.text` is the correct way to access the generated text
|
16 |
+
|
17 |
+
def get_pdf_content(uploaded_file):
|
18 |
+
reader = pdf.PdfReader(uploaded_file)
|
19 |
+
text = ""
|
20 |
+
for page_num in range(len(reader.pages)):
|
21 |
+
page = reader.pages[page_num]
|
22 |
+
text += page.extract_text()
|
23 |
+
return text
|
24 |
+
|
25 |
+
def get_word_content(uploaded_file):
|
26 |
+
reader = docx.Document(uploaded_file)
|
27 |
+
text = ""
|
28 |
+
for para in reader.paragraphs:
|
29 |
+
text += para.text
|
30 |
+
return text
|
31 |
+
|
32 |
+
input_prompt1 = """
|
33 |
+
You are an experienced HR manager,your task is to review the provided resume against the given job description.
|
34 |
+
Please share your professional evaluation on whether the resume aligns with the job description.
|
35 |
+
Highlight the strengths and weaknesses of the resume in relation to the specified job description.
|
36 |
+
resume: {text}
|
37 |
+
job description: {jd}
|
38 |
+
"""
|
39 |
+
|
40 |
+
input_prompt2 = """
|
41 |
+
You are an skilled ATS (Applicant Tracking System) scanner with a deep understanding of any of the following roles
|
42 |
+
software engineering or Data Analyst or Data Science or big data engineer or Product Manager or HR or Business Analyst
|
43 |
+
and ATS functionality as well. Your task is to give the percentage of match if the resume matches to the job description with
|
44 |
+
a high accuracy rate.First output the percentage match then followed by list of keywords that are missing.
|
45 |
+
Also, your need to evaluate the resume against the provided job description.further, provide recommendations for
|
46 |
+
enhancing the candidate's skills and identify which areas require further development.
|
47 |
+
resume: {text}
|
48 |
+
job description: {jd}
|
49 |
+
"""
|
50 |
+
|
51 |
+
input_prompt3 = """
|
52 |
+
You are an skilled ATS (Applicant Tracking System) scanner with a deep understanding of any of the following roles
|
53 |
+
software engineering or Data Analyst or Data Science or big data engineer or Product Manager or HR or Business Analyst
|
54 |
+
and ATS functionality as well. Your task is to list down the keywords that are missing while comparing job description
|
55 |
+
with the uploaded resume.Also, provide recommendations for enhancing the candidate's skills that is there in the resume
|
56 |
+
and identify which areas require further development.
|
57 |
+
resume: {text}
|
58 |
+
job description: {jd}
|
59 |
+
"""
|
60 |
+
st.set_page_config(page_title="ATS App")
|
61 |
+
st.markdown("<h1 style='text-align: center;'>Application Tracking System</h1>", unsafe_allow_html=True)
|
62 |
+
st.header("Improve Resume using ATS Assistance ✒️")
|
63 |
+
jd = st.text_area("Copy & Paste The JD here")
|
64 |
+
uploaded_file = st.file_uploader("Upload Your Resume only in PDF or WORD Format", type=['pdf', 'docx'], help='Please upload the Pdf or Word')
|
65 |
+
|
66 |
+
if uploaded_file is not None:
|
67 |
+
file_type = uploaded_file.type.split('/')[-1].upper()
|
68 |
+
if file_type == "PDF":
|
69 |
+
st.write(f"📄 {file_type} Uploaded Successfully")
|
70 |
+
elif file_type == "VND.OPENXMLFORMATS-OFFICEDOCUMENT.WORDPROCESSINGML.DOCUMENT":
|
71 |
+
st.write(f"📝 WORD Uploaded Successfully")
|
72 |
+
|
73 |
+
submit1 = st.button("Summarize About the Resume & Suggest to improvise skills")
|
74 |
+
submit2 = st.button("Percentage match")
|
75 |
+
submit3 = st.button("Important Keywords Missing?")
|
76 |
+
|
77 |
+
if uploaded_file is not None:
|
78 |
+
file_type = uploaded_file.type
|
79 |
+
if file_type == 'application/pdf':
|
80 |
+
text = get_pdf_content(uploaded_file)
|
81 |
+
elif file_type == 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
82 |
+
text = get_word_content(uploaded_file)
|
83 |
+
|
84 |
+
if submit1:
|
85 |
+
response = get_gemini_response(input_prompt1.format(text=text, jd=jd))
|
86 |
+
st.subheader("The Response is")
|
87 |
+
st.write(response)
|
88 |
+
|
89 |
+
if submit2:
|
90 |
+
response = get_gemini_response(input_prompt2.format(text=text, jd=jd))
|
91 |
+
st.subheader("The Response is")
|
92 |
+
st.write(response)
|
93 |
+
|
94 |
+
if submit3:
|
95 |
+
response = get_gemini_response(input_prompt3.format(text=text, jd=jd))
|
96 |
+
st.subheader("The Response is")
|
97 |
+
st.write(response)
|
98 |
+
else:
|
99 |
+
st.write("Please upload a PDF or Word file to proceed.")
|