Nassiraaa commited on
Commit
4fe2251
·
verified ·
1 Parent(s): e678acb

Update cv_analyzer.py

Browse files
Files changed (1) hide show
  1. cv_analyzer.py +6 -14
cv_analyzer.py CHANGED
@@ -1,16 +1,13 @@
1
  import json
2
  import logging
3
- import tempfile
4
- import os
5
  from cv_prompt import (
6
  ResumeQualityEvaluation,
7
- get_section_detection_prompt,
8
- get_content_quality_prompt,
9
- calculate_section_detection_score,
10
  calculate_overall_score
11
  )
12
  from openai_utils import get_ai_response
13
- from ocr_extractor import process_file
14
  from langchain.output_parsers import PydanticOutputParser
15
  from spelling_grammar_checker import evaluate_cv_text
16
  from personal_information import analyze_personal_info
@@ -18,8 +15,7 @@ from personal_information import analyze_personal_info
18
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
19
 
20
  def analyze_cv(text):
21
-
22
-
23
  # Personal Information Analysis
24
  personal_info = analyze_personal_info(text)
25
 
@@ -54,7 +50,7 @@ def analyze_cv(text):
54
  logging.info(f"Overall score: {overall_score}")
55
 
56
  return {
57
- "extracted_text": extracted_text,
58
  "personal_info": personal_info,
59
  "spelling_grammar_error_percentage": error_percentage,
60
  "spelling_grammar_score": spelling_grammar_score,
@@ -65,8 +61,4 @@ def analyze_cv(text):
65
  }
66
  except Exception as e:
67
  logging.error(f"Error in CV analysis: {str(e)}", exc_info=True)
68
- return {"error": str(e)}
69
- finally:
70
- # Clean up the temporary file
71
- if 'temp_file_path' in locals():
72
- os.unlink(temp_file_path)
 
1
  import json
2
  import logging
 
 
3
  from cv_prompt import (
4
  ResumeQualityEvaluation,
5
+ get_section_detection_prompt,
6
+ get_content_quality_prompt,
7
+ calculate_section_detection_score,
8
  calculate_overall_score
9
  )
10
  from openai_utils import get_ai_response
 
11
  from langchain.output_parsers import PydanticOutputParser
12
  from spelling_grammar_checker import evaluate_cv_text
13
  from personal_information import analyze_personal_info
 
15
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
16
 
17
  def analyze_cv(text):
18
+ try:
 
19
  # Personal Information Analysis
20
  personal_info = analyze_personal_info(text)
21
 
 
50
  logging.info(f"Overall score: {overall_score}")
51
 
52
  return {
53
+ "extracted_text": text,
54
  "personal_info": personal_info,
55
  "spelling_grammar_error_percentage": error_percentage,
56
  "spelling_grammar_score": spelling_grammar_score,
 
61
  }
62
  except Exception as e:
63
  logging.error(f"Error in CV analysis: {str(e)}", exc_info=True)
64
+ return {"error": str(e)}