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