srijaydeshpande commited on
Commit
5c7d67b
·
verified ·
1 Parent(s): 88ca8b7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -51
app.py CHANGED
@@ -90,62 +90,62 @@ def craft_cv(llm, prompt, maxtokens, temperature, top_probability):
90
  return cv_text, output
91
 
92
  def convert_to_json(llm, cv_text, maxtokens, temperature, top_probability):
93
- # prompt = """
94
- # You are an expert at structuring resumes in JSON format. Given a modified resume text, extract the relevant details and convert them into the following structured JSON format:
95
 
96
- # {
97
- # "profileDetail": {
98
- # "name": "[Candidate's Name]",
99
- # "email": "[Candidate's Email]",
100
- # "phone": "[Candidate's Phone]",
101
- # "linkedin": "[Candidate's LinkedIn]",
102
- # "languages": "Hindi,English",
103
- # "interests": "Cricket",
104
- # "location": "[Candidate's Location]",
105
- # "role": "[Candidate's Role]"
106
- # },
107
- # "professionalSummary": "[Candidate's Professional Summary]",
108
- # "skills": ["skill1", "skill2"],
109
- # "workExperience": [
110
- # {
111
- # "title": "[Job Title]",
112
- # "company": "[Company Name]",
113
- # "location": "[Location]",
114
- # "startDate": "[Start Date]",
115
- # "endDate": "[End Date]",
116
- # "responsibilities": ["[Responsibility 1]", "[Responsibility 2]"],
117
- # "projects": [
118
- # {
119
- # "title": "[Project Title]",
120
- # "description": "[Project Description]"
121
- # }
122
- # ]
123
- # }
124
- # ],
125
- # "education": [
126
- # {
127
- # "degree": "[Degree]",
128
- # "institution": "[Institution]",
129
- # "location": "[Location]",
130
- # "graduationDate": "[Graduation Date]"
131
- # }
132
- # ],
133
- # "certifications": ["[Certification 1]", "[Certification 2]"] ,
134
- # "extraCurricular": "[Extra Curricular Activities]",
135
- # "achievment": "[Achievements]"
136
- # }
137
 
138
- # Instructions:
139
- # - Extract details accurately from the given resume.
140
- # - Ensure proper structuring of dates, responsibilities, and projects.
141
- # - If a field is missing in the input, leave it as an empty string or an empty list where applicable.
142
- # - Maintain proper formatting and avoid unnecessary additions.
143
 
144
- # Provide the response in a valid JSON format with no additional explanations.
145
- # """
146
  output = llm.create_chat_completion(
147
  messages=[
148
- {"from": "user", "value": prompt + ' CV text: ' + cv_text},
149
  # {"from": "user", "value": prompt + ' CV text: ' + cv_text},
150
  ],
151
  max_tokens=maxtokens,
 
90
  return cv_text, output
91
 
92
  def convert_to_json(llm, cv_text, maxtokens, temperature, top_probability):
93
+ json_format = """
94
+ You are an expert at structuring resumes in JSON format. Given a modified resume text, extract the relevant details and convert them into the following structured JSON format:
95
 
96
+ {
97
+ "profileDetail": {
98
+ "name": "[Candidate's Name]",
99
+ "email": "[Candidate's Email]",
100
+ "phone": "[Candidate's Phone]",
101
+ "linkedin": "[Candidate's LinkedIn]",
102
+ "languages": "Hindi,English",
103
+ "interests": "Cricket",
104
+ "location": "[Candidate's Location]",
105
+ "role": "[Candidate's Role]"
106
+ },
107
+ "professionalSummary": "[Candidate's Professional Summary]",
108
+ "skills": ["skill1", "skill2"],
109
+ "workExperience": [
110
+ {
111
+ "title": "[Job Title]",
112
+ "company": "[Company Name]",
113
+ "location": "[Location]",
114
+ "startDate": "[Start Date]",
115
+ "endDate": "[End Date]",
116
+ "responsibilities": ["[Responsibility 1]", "[Responsibility 2]"],
117
+ "projects": [
118
+ {
119
+ "title": "[Project Title]",
120
+ "description": "[Project Description]"
121
+ }
122
+ ]
123
+ }
124
+ ],
125
+ "education": [
126
+ {
127
+ "degree": "[Degree]",
128
+ "institution": "[Institution]",
129
+ "location": "[Location]",
130
+ "graduationDate": "[Graduation Date]"
131
+ }
132
+ ],
133
+ "certifications": ["[Certification 1]", "[Certification 2]"] ,
134
+ "extraCurricular": "[Extra Curricular Activities]",
135
+ "achievment": "[Achievements]"
136
+ }
137
 
138
+ Instructions:
139
+ - Extract details accurately from the given resume.
140
+ - Ensure proper structuring of dates, responsibilities, and projects.
141
+ - If a field is missing in the input, leave it as an empty string or an empty list where applicable.
142
+ - Maintain proper formatting and avoid unnecessary additions.
143
 
144
+ Provide the response in a valid JSON format with no additional explanations.
145
+ """
146
  output = llm.create_chat_completion(
147
  messages=[
148
+ {"from": "user", "value": json_format + ' CV text: ' + cv_text},
149
  # {"from": "user", "value": prompt + ' CV text: ' + cv_text},
150
  ],
151
  max_tokens=maxtokens,