Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -72,7 +72,7 @@ def generate_response(message: str, system_prompt: str, temperature: float, max_
|
|
72 |
return response.choices[0].message.content
|
73 |
|
74 |
|
75 |
-
def
|
76 |
prompt = f"""
|
77 |
Please analyze the following resume in the context of the job description provided. Strictly check every single line in the job description and analyze the resume for exact matches. Maintain high ATS standards and give scores only to the correct matches. Focus on missing core skills and soft skills. Provide the following details:
|
78 |
1. The match percentage of the resume to the job description.
|
@@ -84,6 +84,31 @@ def analyze_resume(resume_text, job_description, temperature, max_tokens):
|
|
84 |
"""
|
85 |
return generate_response(prompt, "You are an expert ATS resume analyzer.", temperature, max_tokens)
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
def rephrase_text(text, temperature, max_tokens):
|
88 |
prompt = f"""
|
89 |
Please rephrase the following text according to ATS standards, including quantifiable measures and improvements where possible. Maintain precise and concise points which will pass ATS screening:
|
@@ -100,6 +125,7 @@ with gr.Blocks(css=CSS, theme="Nymbo/Nymbo_Theme") as demo:
|
|
100 |
with gr.Tab("Resume Analyzer"):
|
101 |
with gr.Row():
|
102 |
with gr.Column():
|
|
|
103 |
job_description = gr.Textbox(label="Job Description", lines=5)
|
104 |
resume_file = gr.File(label="Upload Resume (PDF or DOCX)")
|
105 |
with gr.Column():
|
@@ -119,7 +145,14 @@ with gr.Blocks(css=CSS, theme="Nymbo/Nymbo_Theme") as demo:
|
|
119 |
max_tokens = gr.Slider(
|
120 |
minimum=50, maximum=1024, step=1, value=512, label="Max tokens",
|
121 |
)
|
|
|
|
|
122 |
|
|
|
|
|
|
|
|
|
|
|
123 |
def process_resume(file):
|
124 |
if file is not None:
|
125 |
file_type = file.name.split('.')[-1].lower()
|
@@ -133,7 +166,7 @@ with gr.Blocks(css=CSS, theme="Nymbo/Nymbo_Theme") as demo:
|
|
133 |
|
134 |
analyze_btn.click(
|
135 |
analyze_resume,
|
136 |
-
inputs=[resume_content, job_description, temperature, max_tokens],
|
137 |
outputs=[output]
|
138 |
)
|
139 |
|
|
|
72 |
return response.choices[0].message.content
|
73 |
|
74 |
|
75 |
+
def analyze_resume_with_job_description(resume_text, job_description, temperature, max_tokens):
|
76 |
prompt = f"""
|
77 |
Please analyze the following resume in the context of the job description provided. Strictly check every single line in the job description and analyze the resume for exact matches. Maintain high ATS standards and give scores only to the correct matches. Focus on missing core skills and soft skills. Provide the following details:
|
78 |
1. The match percentage of the resume to the job description.
|
|
|
84 |
"""
|
85 |
return generate_response(prompt, "You are an expert ATS resume analyzer.", temperature, max_tokens)
|
86 |
|
87 |
+
def analyze_resume_without_job_description(resume_text, temperature, max_tokens):
|
88 |
+
prompt = f"""
|
89 |
+
Please analyze the following resume without a specific job description. Provide the following details:
|
90 |
+
1. An overall score out of 10 for the resume.
|
91 |
+
2. Suggestions for improvements based on the following criteria:
|
92 |
+
- Impact (quantification, repetition, verb usage, tenses, responsibilities, spelling & consistency)
|
93 |
+
- Brevity (length, bullet points, filler words)
|
94 |
+
- Style (buzzwords, dates, contact details, personal pronouns, active voice, consistency)
|
95 |
+
- Sections (summary, education, skills, unnecessary sections)
|
96 |
+
3. A cumulative assessment of all the above fields.
|
97 |
+
4. Recommendations for improving the resume in 3-4 points with examples.
|
98 |
+
|
99 |
+
Resume: {resume_text}
|
100 |
+
"""
|
101 |
+
return generate_response(prompt, "You are an expert ATS resume analyzer.", temperature, max_tokens)
|
102 |
+
|
103 |
+
|
104 |
+
def analyze_resume(resume_text, job_description, with_job_description, temperature, max_tokens):
|
105 |
+
if with_job_description:
|
106 |
+
return analyze_resume_with_job_description(resume_text, job_description, temperature, max_tokens)
|
107 |
+
else:
|
108 |
+
return analyze_resume_without_job_description(resume_text, temperature, max_tokens)
|
109 |
+
|
110 |
+
|
111 |
+
|
112 |
def rephrase_text(text, temperature, max_tokens):
|
113 |
prompt = f"""
|
114 |
Please rephrase the following text according to ATS standards, including quantifiable measures and improvements where possible. Maintain precise and concise points which will pass ATS screening:
|
|
|
125 |
with gr.Tab("Resume Analyzer"):
|
126 |
with gr.Row():
|
127 |
with gr.Column():
|
128 |
+
with_job_description = gr.Checkbox(label="Analyze with Job Description", value=True)
|
129 |
job_description = gr.Textbox(label="Job Description", lines=5)
|
130 |
resume_file = gr.File(label="Upload Resume (PDF or DOCX)")
|
131 |
with gr.Column():
|
|
|
145 |
max_tokens = gr.Slider(
|
146 |
minimum=50, maximum=1024, step=1, value=512, label="Max tokens",
|
147 |
)
|
148 |
+
def update_job_description_visibility(with_job_description):
|
149 |
+
return gr.update(visible=with_job_description)
|
150 |
|
151 |
+
with_job_description.change(
|
152 |
+
update_job_description_visibility,
|
153 |
+
inputs=[with_job_description],
|
154 |
+
outputs=[job_description]
|
155 |
+
)
|
156 |
def process_resume(file):
|
157 |
if file is not None:
|
158 |
file_type = file.name.split('.')[-1].lower()
|
|
|
166 |
|
167 |
analyze_btn.click(
|
168 |
analyze_resume,
|
169 |
+
inputs=[resume_content, job_description, with_job_description, temperature, max_tokens],
|
170 |
outputs=[output]
|
171 |
)
|
172 |
|