Update cv_analyzer.py
Browse files- cv_analyzer.py +6 -3
cv_analyzer.py
CHANGED
|
@@ -22,10 +22,13 @@ def detect_cv_sections_and_score(text):
|
|
| 22 |
|
| 23 |
response = llm(prompt, max_tokens=500)
|
| 24 |
|
|
|
|
|
|
|
|
|
|
| 25 |
# Extract the JSON part from the response
|
| 26 |
-
json_start =
|
| 27 |
-
json_end =
|
| 28 |
-
json_str =
|
| 29 |
|
| 30 |
try:
|
| 31 |
detected_sections = json.loads(json_str)
|
|
|
|
| 22 |
|
| 23 |
response = llm(prompt, max_tokens=500)
|
| 24 |
|
| 25 |
+
# Extract the content from the response dictionary
|
| 26 |
+
response_text = response['choices'][0]['text']
|
| 27 |
+
|
| 28 |
# Extract the JSON part from the response
|
| 29 |
+
json_start = response_text.find('{')
|
| 30 |
+
json_end = response_text.rfind('}') + 1
|
| 31 |
+
json_str = response_text[json_start:json_end]
|
| 32 |
|
| 33 |
try:
|
| 34 |
detected_sections = json.loads(json_str)
|