Spaces:
Sleeping
Sleeping
Vaishvik1618
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -1,140 +1,110 @@
|
|
1 |
-
import
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
#
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
st.
|
47 |
-
st.
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
"""
|
70 |
-
|
71 |
-
|
72 |
-
You are an
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
response = ai_output(input_text,
|
89 |
-
st.subheader("The Response is
|
90 |
-
st.write(response)
|
91 |
-
else:
|
92 |
-
st.write("Please
|
93 |
-
elif submit2:
|
94 |
-
if
|
95 |
-
|
96 |
-
|
97 |
-
st.
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
hiring_manager_name = st.text_input("Enter the Hiring Manager's Name (optional)")
|
112 |
-
job_role = st.text_area("Enter job role")
|
113 |
-
|
114 |
-
if uploaded_file is not None:
|
115 |
-
pdf_content = input_pdf_setup(uploaded_file)
|
116 |
-
cover_letter_button = st.button("Generate Cover Letter")
|
117 |
-
if not applicant_name:
|
118 |
-
st.write("Warning: Applicant's Name is missing.")
|
119 |
-
if not contact_info:
|
120 |
-
st.write("Warning: Contact Information is missing.")
|
121 |
-
|
122 |
-
if cover_letter_button:
|
123 |
-
# Define the input prompt for the cover letter
|
124 |
-
input_prompt_cover_letter = f"""
|
125 |
-
You are an expert cover letter writer. Generate a tailored cover letter using the following details:
|
126 |
-
|
127 |
-
Applicant's Name: {applicant_name}
|
128 |
-
Contact Information: {contact_info}
|
129 |
-
Company Name: {company_name}
|
130 |
-
Hiring Manager's Name: {hiring_manager_name}
|
131 |
-
Job Role/Position Name: {job_role}
|
132 |
-
|
133 |
-
The cover letter should include an engaging introduction, highlight relevant skills and experiences,
|
134 |
-
and conclude with a strong closing statement expressing enthusiasm for the role.
|
135 |
-
"""
|
136 |
-
cover_letter_response = ai_output(input_text, pdf_content, input_prompt_cover_letter)
|
137 |
-
st.subheader("Generated Cover Letter:")
|
138 |
-
st.write(cover_letter_response)
|
139 |
-
else:
|
140 |
-
st.write("Please upload the Resume to generate a cover letter.")
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import fitz # PyMuPDF
|
3 |
+
import google.generativeai as genai
|
4 |
+
|
5 |
+
# Configure the Generative AI model
|
6 |
+
genai.configure(api_key="AIzaSyBqPmsZAJrCsXme9wJBx9o4K71M9c1qzy8")
|
7 |
+
|
8 |
+
def ai_output(input_text, pdf_text, prompt):
|
9 |
+
model = genai.GenerativeModel('gemini-1.5-flash')
|
10 |
+
combined_input = f"{input_text}\n\n{pdf_text}\n\n{prompt}"
|
11 |
+
response = model.generate_content(combined_input)
|
12 |
+
return response.text
|
13 |
+
|
14 |
+
def ai_ans(input_text, prompt):
|
15 |
+
model = genai.GenerativeModel('gemini-1.5-flash')
|
16 |
+
combined_input = f"{input_text}\n\n{prompt}"
|
17 |
+
response = model.generate_content(combined_input)
|
18 |
+
return response.text
|
19 |
+
|
20 |
+
def input_pdf_setup(uploaded_file):
|
21 |
+
if uploaded_file is not None:
|
22 |
+
pdf_document = fitz.open(stream=uploaded_file.read(), filetype="pdf")
|
23 |
+
text = ""
|
24 |
+
for page_num in range(len(pdf_document)):
|
25 |
+
page = pdf_document.load_page(page_num)
|
26 |
+
text += page.get_text()
|
27 |
+
pdf_document.close()
|
28 |
+
return text
|
29 |
+
else:
|
30 |
+
raise FileNotFoundError("No file uploaded")
|
31 |
+
|
32 |
+
st.set_page_config(page_title="ATS Resume Expert")
|
33 |
+
st.header("HARIMAY ATS Tracking System")
|
34 |
+
|
35 |
+
input_text = st.text_area("Job Description:", key="input")
|
36 |
+
uploaded_file = st.file_uploader("Upload your resume (PDF)...", type=["pdf"])
|
37 |
+
job_role = st.text_input("Enter Job Role", key="job")
|
38 |
+
|
39 |
+
if uploaded_file is not None:
|
40 |
+
pdf_text = input_pdf_setup(uploaded_file)
|
41 |
+
st.write("PDF file uploaded and processed successfully.")
|
42 |
+
else:
|
43 |
+
pdf_text = ""
|
44 |
+
st.write("Please upload the resume.")
|
45 |
+
|
46 |
+
submit1 = st.button("Tell me about the Resume")
|
47 |
+
submit2 = st.button("Percentage Match")
|
48 |
+
submit3 = st.button("Job Skills")
|
49 |
+
submit4 = st.button("Missing Keywords")
|
50 |
+
|
51 |
+
input_prompt1 = """
|
52 |
+
You are an experienced Technical Human Resource Manager. Your task is to review the provided resume against the job description.
|
53 |
+
Please share your professional evaluation on whether the candidate's profile aligns with the role.
|
54 |
+
Highlight the strengths and weaknesses of the applicant in relation to the specified job requirements.
|
55 |
+
"""
|
56 |
+
|
57 |
+
input_prompt2 = """
|
58 |
+
You are a skilled ATS (Applicant Tracking System) scanner with a deep understanding of ATS functionality.
|
59 |
+
Your task is to evaluate the resume against the provided job description. Provide the percentage match if the resume aligns
|
60 |
+
with the job description. First, present the output as a percentage, then list missing keywords, and finally, offer your thoughts.
|
61 |
+
"""
|
62 |
+
|
63 |
+
input_prompt3 = """
|
64 |
+
You are an advanced career advisor and job market expert with deep insights into various industries. When given a job role, your task is to identify and list the key skills and qualifications that are most commonly required for success in that position. Please provide a structured output that includes:
|
65 |
+
|
66 |
+
1. A detailed list of technical and hard skills.
|
67 |
+
2. A summary of soft skills crucial for the role.
|
68 |
+
3. Recommended educational qualifications and certifications associated with the job.
|
69 |
+
"""
|
70 |
+
|
71 |
+
input_prompt4 = """
|
72 |
+
You are an expert in resume optimization and keyword integration for job applications. I am providing my resume content along with a job description. Your task is to analyze the resume and identify any important keywords or skills from the job description that are missing in my resume. For each missing keyword or skill, provide the following:
|
73 |
+
|
74 |
+
1.A clear explanation of all the missing keyword or skill and why it is important for the role.
|
75 |
+
2.A detailed suggestion for a sentence or bullet point that can be added to the resume to include the missing keyword.
|
76 |
+
3.Guidance on where in the resume (e.g., Professional Experience, Skills, Education, Projects) the new content should be inserted for the best impact.
|
77 |
+
Ensure that the suggestions are tailored to the context of my existing resume, maintaining a natural flow and relevance to my career background
|
78 |
+
and also tell that you experience is less that what this job is expected
|
79 |
+
|
80 |
+
also get the list of missing keywords
|
81 |
+
|
82 |
+
and tell me why I would not select for an interview for this position according to my resume
|
83 |
+
|
84 |
+
"""
|
85 |
+
|
86 |
+
if submit1:
|
87 |
+
if pdf_text:
|
88 |
+
response = ai_output(input_text, pdf_text, input_prompt1)
|
89 |
+
st.subheader("The Response is:")
|
90 |
+
st.write(response)
|
91 |
+
else:
|
92 |
+
st.write("Please upload the resume.")
|
93 |
+
elif submit2:
|
94 |
+
if pdf_text:
|
95 |
+
response = ai_output(input_text, pdf_text, input_prompt2)
|
96 |
+
st.subheader("The Response is:")
|
97 |
+
st.write(response)
|
98 |
+
else:
|
99 |
+
st.write("Please upload the resume.")
|
100 |
+
elif submit3:
|
101 |
+
response = ai_ans(job_role, input_prompt3)
|
102 |
+
st.subheader("The Response is:")
|
103 |
+
st.write(response)
|
104 |
+
elif submit4:
|
105 |
+
if pdf_text:
|
106 |
+
response = ai_output(input_text, pdf_text, input_prompt4)
|
107 |
+
st.subheader("Missing things which need to be present in your resume:")
|
108 |
+
st.write(response)
|
109 |
+
|
110 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|