Spaces:
Running
Running
Download backend/src/loader.py from SarthakVE/Resume_Analyzer: direct link, hf CLI and curl.
- Browser
- Download file 990 Bytes
-
https://huggingface.co/spaces/SarthakVE/Resume_Analyzer/resolve/main/backend/src/loader.py
- Command line
-
hf download hf://spaces/SarthakVE/Resume_Analyzer/backend/src/loader.py
-
curl -L -o loader.py https://huggingface.co/spaces/SarthakVE/Resume_Analyzer/resolve/main/backend/src/loader.py
990 Bytes
| from langchain_community.document_loaders import PyMuPDFLoader, TextLoader, Docx2txtLoader | |
| from pathlib import Path | |
| def load_JD(file_path): | |
| loader = TextLoader(file_path, encoding="utf-8") | |
| documents = loader.load() | |
| return documents | |
| # def load_resume(file_path): | |
| # loader = PyMuPDFLoader(file_path) | |
| # documents = loader.load() | |
| # return documents | |
| def load_resume(file_path): | |
| extension=Path(file_path).suffix.lower() | |
| if extension==".pdf": | |
| loader=PyMuPDFLoader(file_path) | |
| elif extension==".docx": | |
| loader=Docx2txtLoader(file_path) | |
| else: | |
| raise ValueError(f"Unsupported resume format: {extension}. Supported are .pdf and .docx only.") | |
| return loader.load() | |
| # # Loop through all pages and print their text content | |
| # for doc in documents: | |
| # print(doc.page_content) | |
| # print("-" * 50) # Just a separator line between pages | |
| # return documents | |