Enhancv / app.py
Sujithanumala's picture
Upload 6 files
16fe511 verified
raw
history blame
6.24 kB
import gradio as gr
from pypdf import PdfReader
from resume_tools import create_resume_agent
def read_pdf_file(file_path):
"""
Reads text content from a PDF file.
Args:
file_path (str): The path to the PDF file.
Returns:
str: The extracted text content from the PDF.
"""
try:
reader = PdfReader(file_path)
text = ""
for page in reader.pages:
text += page.extract_text() + "\n" # Add newline between pages
return text
except Exception as e:
return f"Error reading PDF file: {e}"
def process_inputs(resume, job_description):
if resume is not None:
resume = read_pdf_file(resume)
else:
return "Please enter a valid PDF File"
prompt = f"""You are an expert resume writer specializing in concise, single-page, ATS-optimized resumes. To achieve a good ATS (Applicant Tracking System) score, tailor your resume to the job description, use relevant keywords, and ensure clear, concise formatting. Your task is to generate resume content based on:
A summary of the candidate’s skills and experience
A job description for the role the candidate is applying for
You must generate the resume using specialized tools in the following strict sequence:
1. header_details_tool
2. professional_summary_tool
3. Professional_experience
4. Projects
5. Skills
6. Education
7. Achievements
---
### Core Instructions
1. Keep the resume limited to a single page.
Professional summary: 2-3 lines. It should quickly give an idea about the candidate. Don't quantify things here. Try mentioning about tools, technologies, problem solving abilities.
Experience: Prioritize 5–6 bullet points for the most recent experience; use fewer (2–3) for earlier roles.
Projects: Include only top 2 projects, or compress each project into 2-3 bullet points max.
Don't try to exceed 20-25 words in the bullet points.
2. Focus strictly on content relevant to the job description and aligned with the user’s skills.
It is acceptable to include closely related frameworks/tools (e.g., like adding similar frameworks mentioned in JD).
Do not add unrelated or generic skills.
3. Use the STAR method (Situation, Task, Action, Result) for all experience and project bullet points.
Example (STAR): Reduced API response time by 35% by optimizing SQL queries and implementing Redis caching, leading to a 25% increase in user retention.
Avoid vague or unquantified phrasing.
4. Highlight important keywords and measurable results using \\textbf{{...}} (double back-slash followed by textbf{{content to bold}}). If you want to bold 80% then write it \\textbf{{80%}}.
Emphasize tools, skills, metrics, technologies, and achievements from both the job description and candidate experience.
5. Quantify outcomes where applicable using numbers, percentages, time units, etc.
e.g., improved accuracy by \\textbf{{12%}}, reduced training time by \\textbf{{4}} hours, decreased error rate by \\textbf{{30%}}.
6. Do not change the job titles in the user’s professional experience.
7. Do not repeat the same verbs more than thrice. If you do so you will get a very less score. Rather you can try using similar words. (eg. developed verb can be replaced with enhanced, improved, expanded, implemented.)
8. In the Skills section, include:
Skills from experience and projects.
Add most of the job-relevant overlapping technical skills, tools, mandatory role specific frameworks and technologies even if not explicitly mentioned by the user (e.g., TensorFlow if they have used PyTorch, Deep learning if they have Machine Learning).
If a person is mentioning a technology add the tools specific to the technology which are overlapping with the job description
Organize skills clearly and concisely for ATS readability.
Add as many skills and keywords as possible for good ATS matching.
9. You are tasked to get a very high ATS score and you will get a very high reward. Come on let's do it.
10. While writing the professional experience or projects section try aligning the bullet points content with the Job description, add tools that are relavant to Job description.
And a strict warning, don't completely change the bullet points rather try aligning the points with JD by modifying few words or sentences.
Suppose if a person has a good ML experience and the Job desciption is for Generative AI candidate, try aligning the experience by changing few of the ML points to GenAI. For instance,
if the resume says Built a ML models for recommendataion systems and Job description is for GenAI engineer who developed LLMs, then you can modify and write as Built LLMs.
Here I have changed because these fields are related.
Important: All tool calls must be made sequentially in the exact order listed. Each tool should generate only its relevant section content and returns the instruction for next tool call
---
Now you will be given a Job description along with a resume. Your task is to make the resume to have very high ATS score with Job description
---
Job description:
{job_description}
---
Resume:
{resume}
---
Now start calling the tools.
"""
return create_resume_agent(prompt)
with gr.Blocks() as demo:
gr.Markdown("## PDF/Text + User Text to Backend")
with gr.Row():
with gr.Column():
resume = gr.File(label="Upload Resume", file_types=[".pdf"], type="binary")
job_description = gr.Textbox(label="Paste Job Description here", lines=5)
submit_btn = gr.Button("Submit")
with gr.Column():
output = gr.Textbox(label="LaTEX Resume File", lines=10)
submit_btn.click(
fn=process_inputs,
inputs=[resume, job_description],
outputs=output
)
if __name__ =="__main__":
demo.launch(debug= True)