edouardlgp commited on
Commit
91721d4
·
verified ·
1 Parent(s): 46c024e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -16
app.py CHANGED
@@ -1058,37 +1058,45 @@ def generate_word_document(json_path: Optional[str]) -> str:
1058
 
1059
  doc.add_heading('Responsibilities', level=2)
1060
  doc.add_paragraph(result['responsibilities'])
1061
-
 
 
 
 
 
 
 
 
1062
  doc.add_heading('Qualifications', level=2)
1063
  for item in result['qualification']:
1064
  doc.add_paragraph(item, style='List Bullet')
1065
-
1066
  doc.add_heading('Interview Questions', level=2)
1067
  for item in result['interview']:
1068
  doc.add_paragraph(item, style='List Bullet')
1069
 
1070
- doc.add_heading('Skills (Extracted)', level=2)
1071
- for skill in result['skills'].get("skills", []):
1072
- doc.add_paragraph(f"{skill.get('skill_name', 'Unnamed Skill')} - {skill.get('description', '')}")
1073
-
1074
- doc.add_heading('Skills (ESCO)', level=2)
1075
- for skill in result['skills_esco'].get("skills", []):
1076
- doc.add_paragraph(f"{skill.get('skill_name', 'Unnamed Skill')} - {skill.get('description', '')}")
1077
-
1078
  if result["ccog_levels"]:
1079
  doc.add_heading('C-COG Levels', level=2)
1080
  for key, value in result["ccog_levels"].items():
1081
  doc.add_paragraph(f"{key}: {value}")
1082
 
1083
- if result["esco_levels"]:
1084
- doc.add_heading('ESCO Levels', level=2)
1085
- for key, value in result["esco_levels"].items():
1086
- doc.add_paragraph(f"{key}: {value}")
1087
-
1088
 
 
 
 
 
 
 
 
 
1089
  # Footer
1090
  doc.add_paragraph()
1091
- doc.add_paragraph("Generated by IOM Talent Management AI Tool", style='Footer')
1092
 
1093
  except Exception as e:
1094
  log_debug(f"Error generating document content: {str(e)}")
 
1058
 
1059
  doc.add_heading('Responsibilities', level=2)
1060
  doc.add_paragraph(result['responsibilities'])
1061
+
1062
+ # Skills (Extracted)
1063
+ doc.add_heading('Skills (Extracted)', level=2)
1064
+ skills_list = result['skills']
1065
+ if isinstance(skills_list, dict):
1066
+ skills_list = skills_list.get("skills", [])
1067
+ for skill in skills_list:
1068
+ doc.add_paragraph(f"{skill.get('skill_name', 'Unnamed Skill')} - {skill.get('description', '')}")
1069
+
1070
  doc.add_heading('Qualifications', level=2)
1071
  for item in result['qualification']:
1072
  doc.add_paragraph(item, style='List Bullet')
1073
+
1074
  doc.add_heading('Interview Questions', level=2)
1075
  for item in result['interview']:
1076
  doc.add_paragraph(item, style='List Bullet')
1077
 
1078
+ if result["esco_levels"]:
1079
+ doc.add_heading('ESCO Levels', level=2)
1080
+ for key, value in result["esco_levels"].items():
1081
+ doc.add_paragraph(f"{key}: {value}")
1082
+
 
 
 
1083
  if result["ccog_levels"]:
1084
  doc.add_heading('C-COG Levels', level=2)
1085
  for key, value in result["ccog_levels"].items():
1086
  doc.add_paragraph(f"{key}: {value}")
1087
 
 
 
 
 
 
1088
 
1089
+ # Skills (ESCO)
1090
+ doc.add_heading('Skills (ESCO)', level=2)
1091
+ esco_skills_list = result['skills_esco']
1092
+ if isinstance(esco_skills_list, dict):
1093
+ esco_skills_list = esco_skills_list.get("skills", [])
1094
+ for skill in esco_skills_list:
1095
+ doc.add_paragraph(f"{skill.get('skill_name', 'Unnamed Skill')} - {skill.get('description', '')}")
1096
+
1097
  # Footer
1098
  doc.add_paragraph()
1099
+ doc.add_paragraph("DISCLAIMER: This document contains material generated by artificial intelligence technology. While efforts have been made to ensure accuracy, please be aware that AI-generated content may not always fully represent the intent or expertise of human-authored material and may contain errors or inaccuracies. An AI model might generate content that sounds plausible but that is either factually incorrect or unrelated to the given context. These unexpected outcomes, also called AI hallucinations, can stem from biases, under-performing information retrieval, lack of real-world understanding, or limitations in training data.", style='Footer')
1100
 
1101
  except Exception as e:
1102
  log_debug(f"Error generating document content: {str(e)}")