TalentTalkPro / backend /services /resume_parser.py
Param2121's picture
Refactor: Move project to root of repository
3abfc90
Raw
History Blame Contribute Delete
444 Bytes
import fitz # PyMuPDF
from fastapi import UploadFile
async def parse_resume(file: UploadFile) -> str:
"""
Extracts text from a PDF file.
"""
try:
content = await file.read()
doc = fitz.open(stream=content, filetype="pdf")
text = ""
for page in doc:
text += page.get_text()
return text
except Exception as e:
print(f"Error parsing resume: {e}")
return ""