Mangesh223 commited on
Commit
08ba242
·
verified ·
1 Parent(s): 42f54b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -1
app.py CHANGED
@@ -53,7 +53,63 @@ 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 = [ {"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",
 
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 AI expert in Applicant Tracking System (ATS) resume analysis. Your task is to evaluate resumes for ATS compatibility based on provided job descriptions and return results in a specific JSON format."
60
+ },
61
+ {
62
+ "role": "user",
63
+ "content": """
64
+ Analyze the provided resume against the job description for ATS compatibility. Your analysis should assess how well the resume aligns with ATS requirements and the job description in terms of keywords, formatting, skills, experience relevance, and education. Provide detailed recommendations for improvement where applicable.
65
+
66
+ Return the output in EXACTLY this JSON format, with no deviations:
67
+ {
68
+ "ATS Parameters": {
69
+ "Keywords": {
70
+ "Match": <integer score between 0 and 100>,
71
+ "Recommendation": [<list of specific keywords to add or emphasize>]
72
+ },
73
+ "Formatting": {
74
+ "Match": <integer score between 0 and 100>,
75
+ "Recommendation": [<list of specific formatting suggestions>]
76
+ },
77
+ "Skills Match": {
78
+ "Match": <integer score between 0 and 100>,
79
+ "Recommendation": [<list of specific skills to include or highlight>]
80
+ },
81
+ "Experience Relevance": {
82
+ "Match": <integer score between 0 and 100>,
83
+ "Recommendation": [<list of suggestions to improve experience alignment>]
84
+ },
85
+ "Education": {
86
+ "Match": <integer score between 0 and 100>,
87
+ "Recommendation": [<list of suggestions to improve education section>]
88
+ }
89
+ },
90
+ "Score": {
91
+ "Keywords": <integer score between 0 and 100>,
92
+ "Formatting": <integer score between 0 and 100>,
93
+ "Skills Match": <integer score between 0 and 100>,
94
+ "Experience Relevance": <integer score between 0 and 100>,
95
+ "Education": <integer score between 0 and 100>,
96
+ "Overall": <integer average score between 0 and 100>
97
+ }
98
+ }
99
+
100
+ - Ensure all "Match" values are integers between 0 and 100.
101
+ - Ensure "Recommendation" fields are lists of strings, even if empty (e.g., []).
102
+ - Calculate "Overall" as the average of the five "Score" values, rounded to the nearest integer.
103
+ - Base your analysis on typical ATS requirements (e.g., keyword matching, simple formatting, clear section headers) and the specific job description provided.
104
+
105
+ Resume:
106
+ {resume_text}
107
+
108
+ Job Description:
109
+ {job_description}
110
+ """
111
+ }
112
+ ]
113
 
114
  payload = {
115
  "model": "mistralai/Mistral-7B-Instruct-v0.3",