diff --git a/requirements.txt b/requirements.txt index 7705871..e9e78db 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ -python-docx== 0.8.11 +python-docx fastapi -uvicorn \ No newline at end of file +uvicorn +docxtpl \ No newline at end of file diff --git a/service/format_template_resume.py b/service/format_template_resume.py new file mode 100644 index 0000000..863388f --- /dev/null +++ b/service/format_template_resume.py @@ -0,0 +1,35 @@ +from docxtpl import DocxTemplate +from pathlib import Path + +context = { + 'name': '张三', + 'sex': '男', + 'nation': '汉族', + 'brith': '1990-01-01', + 'address': '北京市海淀区西二旗', + 'education': '本科', + 'degree': '学士', + # 籍贯 + 'origin': '山东', + 'politics': '党员', + # 部门 + 'department': '数信部', + 'position': '助理开发工程师', + 'phone': '13812345678', + 'title': '后端开发工程师', + 'start_work_time': '2018-01-01', + # 身份证 + 'id_number': '500221199001010010101', + # 荣誉,交给大模型 + 'honor': '一等奖', + # 工作内容 + 'work_text': ''' + 2023.12-2024.10:负责《边缘计算+5G自组网的水电物联网系统建设与研究》项目异常检测算法和项目实施:利用5G自组网技术、自建边缘计算单元等,实际实现在线异常检测、时间序列趋势分析、模型轻量化等功能,缓解通信带宽压力;在观音岩、彭水、渝能等场站实施应用。完成项目科技成果凝练、项目报奖等工作。本项目工作获得第六届全国设备管理与技术创新成果一等奖、中电联职工创新成果二等奖。 +2024.04-2025.至今:广西河池源网荷储一体化项目/大唐西藏玉曲河扎拉电厂可行性研究报告&方案编写、AI支持中心方案策划 +''' + +} +file_path = Path.cwd().joinpath('template.docx') +template = DocxTemplate(file_path) +template.render(context) +template.save('E://resu//output.docx') diff --git a/service/template.docx b/service/template.docx new file mode 100644 index 0000000..77ee22f Binary files /dev/null and b/service/template.docx differ