Nassiraaa commited on
Commit
02b8c9c
·
verified ·
1 Parent(s): 4b757c8

Update cv_analyzer.py

Browse files
Files changed (1) hide show
  1. cv_analyzer.py +6 -13
cv_analyzer.py CHANGED
@@ -17,24 +17,17 @@ from personal_information import analyze_personal_info
17
 
18
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
19
 
20
- def analyze_cv(file_content):
21
- try:
22
- # Save the file content temporarily
23
- with tempfile.NamedTemporaryFile(delete=False, suffix='.pdf') as temp_file:
24
- temp_file.write(file_content)
25
- temp_file_path = temp_file.name
26
-
27
- extracted_text = process_file(temp_file_path, 'ocr_weights.json')
28
- logging.info("Text extracted successfully")
29
 
30
  # Personal Information Analysis
31
- personal_info = analyze_personal_info(temp_file_path)
32
 
33
  # Spelling and Grammar Check
34
- error_percentage, spelling_grammar_score = evaluate_cv_text(temp_file_path, 'ocr_weights.json')
35
 
36
  # Section Detection
37
- sections_prompt = get_section_detection_prompt(extracted_text)
38
  sections_response = get_ai_response([{"role": "user", "content": sections_prompt}])
39
  if sections_response is None:
40
  return {"error": "Failed to get AI response for sections"}
@@ -46,7 +39,7 @@ def analyze_cv(file_content):
46
  logging.info(f"Section detection score: {section_detection_score}")
47
 
48
  # Content Quality Analysis
49
- quality_prompt = get_content_quality_prompt(extracted_text)
50
  quality_response = get_ai_response([{"role": "user", "content": quality_prompt}])
51
 
52
  if quality_response is None:
 
17
 
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
 
26
  # Spelling and Grammar Check
27
+ error_percentage, spelling_grammar_score = evaluate_cv_text(text)
28
 
29
  # Section Detection
30
+ sections_prompt = get_section_detection_prompt(text)
31
  sections_response = get_ai_response([{"role": "user", "content": sections_prompt}])
32
  if sections_response is None:
33
  return {"error": "Failed to get AI response for sections"}
 
39
  logging.info(f"Section detection score: {section_detection_score}")
40
 
41
  # Content Quality Analysis
42
+ quality_prompt = get_content_quality_prompt(text)
43
  quality_response = get_ai_response([{"role": "user", "content": quality_prompt}])
44
 
45
  if quality_response is None: