Mangesh223 commited on
Commit
37d7e9d
·
verified ·
1 Parent(s): 83ba013

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +79 -43
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
- {"role": "system", "content": "You are an AI expert in ATS resume analysis."},
39
- {"role": "user", "content": f"""
40
- Analyze the following resume against the job description for ATS compatibility.
41
- Provide output in EXACTLY this JSON format:
42
- {{
43
- "ATS Parameters": {{
44
- "Keywords": {{
45
- "Match": [score 0-100],
46
- "Recommendation": [list of keywords]
47
- }},
48
- "Formatting": {{
49
- "Match": [score 0-100],
50
- "Recommendation": [list of suggestions]
51
- }},
52
- "Skills Match": {{
53
- "Match": [score 0-100],
54
- "Recommendation": [list of suggestions]
55
- }},
56
- "Experience Relevance": {{
57
- "Match": [score 0-100],
58
- "Recommendation": [list of suggestions]
59
- }},
60
- "Education": {{
61
- "Match": [score 0-100],
62
- "Recommendation": [list of suggestions]
63
- }}
64
- }},
65
- "Score": {{
66
- "Keywords": [score 0-100],
67
- "Formatting": [score 0-100],
68
- "Skills Match": [score 0-100],
69
- "Experience Relevance": [score 0-100],
70
- "Education": [score 0-100],
71
- "Overall": [average score 0-100]
72
- }}
 
 
 
 
 
 
73
  }}
74
-
75
- Resume:
76
- {resume_text}
77
-
78
- Job Description:
79
- {job_description}
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",