Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,89 +53,7 @@ def analyze_with_mistral(resume_text, job_description):
|
|
| 53 |
TOGETHER_API_KEY = os.getenv("HUGGINGFACE_API_KEY")
|
| 54 |
url = "https://api.together.xyz/v1/chat/completions"
|
| 55 |
|
| 56 |
-
messages = [
|
| 57 |
-
{
|
| 58 |
-
"role": "system",
|
| 59 |
-
"content": """You are an expert in Applicant Tracking Systems (ATS) and resume optimization.
|
| 60 |
-
Your task is to analyze resumes against job descriptions to provide detailed, actionable feedback
|
| 61 |
-
that helps candidates pass ATS screening and impress human reviewers.
|
| 62 |
-
|
| 63 |
-
Follow these guidelines when analyzing resumes:
|
| 64 |
-
1. Focus on keyword matching, but also consider context and semantic relevance
|
| 65 |
-
2. Evaluate formatting for ATS compatibility (proper headings, bullet points, avoid tables/graphics)
|
| 66 |
-
3. Assess skills alignment with job requirements
|
| 67 |
-
4. Evaluate experience relevance, focusing on quantifiable achievements
|
| 68 |
-
5. Consider education relevance to the position
|
| 69 |
-
6. Provide specific, actionable recommendations
|
| 70 |
-
7. Be thorough but concise in your analysis
|
| 71 |
-
|
| 72 |
-
Your analysis must be comprehensive yet practical for the candidate to implement.
|
| 73 |
-
|
| 74 |
-
IMPORTANT: Do not use escaped backslashes in your JSON response.
|
| 75 |
-
"""
|
| 76 |
-
},
|
| 77 |
-
{
|
| 78 |
-
"role": "user",
|
| 79 |
-
"content": f"""
|
| 80 |
-
Analyze the following resume against the job description for ATS compatibility and hiring potential.
|
| 81 |
-
|
| 82 |
-
RESUME:
|
| 83 |
-
{resume_text}
|
| 84 |
-
|
| 85 |
-
JOB DESCRIPTION:
|
| 86 |
-
{job_description}
|
| 87 |
-
|
| 88 |
-
Provide a detailed analysis in EXACTLY the following JSON format (do not escape underscores with backslashes):
|
| 89 |
-
|
| 90 |
-
{{
|
| 91 |
-
"ATS_Compatibility": {{
|
| 92 |
-
"Keywords": {{
|
| 93 |
-
"Score": [0-100],
|
| 94 |
-
"Missing_Keywords": [list of important missing keywords from job description],
|
| 95 |
-
"Recommendation": "Specific advice on how to incorporate missing keywords naturally"
|
| 96 |
-
}},
|
| 97 |
-
"Formatting": {{
|
| 98 |
-
"Score": [0-100],
|
| 99 |
-
"Issues": [list of formatting issues that might affect ATS parsing],
|
| 100 |
-
"Recommendation": "Specific formatting improvements to enhance ATS readability"
|
| 101 |
-
}}
|
| 102 |
-
}},
|
| 103 |
-
"Content_Quality": {{
|
| 104 |
-
"Skills_Match": {{
|
| 105 |
-
"Score": [0-100],
|
| 106 |
-
"Strong_Matches": [list of well-matched skills],
|
| 107 |
-
"Weak_Areas": [list of skill gaps],
|
| 108 |
-
"Recommendation": "Specific suggestions to better highlight relevant skills"
|
| 109 |
-
}},
|
| 110 |
-
"Experience_Relevance": {{
|
| 111 |
-
"Score": [0-100],
|
| 112 |
-
"Strengths": [list of relevant experience highlights],
|
| 113 |
-
"Improvement_Areas": [list of experience gaps or weak points],
|
| 114 |
-
"Recommendation": "Specific suggestions to better position experience"
|
| 115 |
-
}},
|
| 116 |
-
"Achievement_Focus": {{
|
| 117 |
-
"Score": [0-100],
|
| 118 |
-
"Analysis": "Assessment of quantifiable achievements vs. responsibilities",
|
| 119 |
-
"Recommendation": "Specific suggestions to enhance impact with metrics and results"
|
| 120 |
-
}}
|
| 121 |
-
}},
|
| 122 |
-
"Education_Certifications": {{
|
| 123 |
-
"Score": [0-100],
|
| 124 |
-
"Analysis": "Assessment of education/certification relevance",
|
| 125 |
-
"Recommendation": "Suggestions for improvement if needed"
|
| 126 |
-
}},
|
| 127 |
-
"Overall_Assessment": {{
|
| 128 |
-
"Total_Score": [weighted average 0-100],
|
| 129 |
-
"Strengths": [list of 2-3 strongest aspects of the resume],
|
| 130 |
-
"Priority_Improvements": [list of 2-3 highest-impact improvements, ranked],
|
| 131 |
-
"Summary": "Brief, specific summary of the resume's competitiveness for this role"
|
| 132 |
-
}}
|
| 133 |
-
}}
|
| 134 |
-
|
| 135 |
-
Do not escape underscores with backslashes in your response. Ensure all recommendations are specific, actionable, and tailored to both the resume content and job description.
|
| 136 |
-
"""
|
| 137 |
-
}
|
| 138 |
-
]
|
| 139 |
|
| 140 |
payload = {
|
| 141 |
"model": "mistralai/Mistral-7B-Instruct-v0.3",
|
|
|
|
| 53 |
TOGETHER_API_KEY = os.getenv("HUGGINGFACE_API_KEY")
|
| 54 |
url = "https://api.together.xyz/v1/chat/completions"
|
| 55 |
|
| 56 |
+
messages = [ {"role": "system", "content": "You are an AI expert in ATS resume analysis."}, {"role": "user", "content": f""" Analyze the following resume against the job description for ATS compatibility. Provide output in EXACTLY this JSON format: {{ "ATS Parameters": {{ "Keywords": {{ "Match": [score 0-100], "Recommendation": [list of keywords] }}, "Formatting": {{ "Match": [score 0-100], "Recommendation": [list of suggestions] }}, "Skills Match": {{ "Match": [score 0-100], "Recommendation": [list of suggestions] }}, "Experience Relevance": {{ "Match": [score 0-100], "Recommendation": [list of suggestions] }}, "Education": {{ "Match": [score 0-100], "Recommendation": [list of suggestions] }} }}, "Score": {{ "Keywords": [score 0-100], "Formatting": [score 0-100], "Skills Match": [score 0-100], "Experience Relevance": [score 0-100], "Education": [score 0-100], "Overall": [average score 0-100] }} }} Resume: {resume_text} Job Description: {job_description} """} ]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
payload = {
|
| 59 |
"model": "mistralai/Mistral-7B-Instruct-v0.3",
|