Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 94 |
-
|
| 95 |
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
|
| 144 |
-
|
| 145 |
-
|
| 146 |
output = llm.create_chat_completion(
|
| 147 |
messages=[
|
| 148 |
-
{"from": "user", "value":
|
| 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,
|