Spaces:
Sleeping
Sleeping
Download loader.py from Aaravkumar/RAG-Chatbot: direct link, hf CLI and curl.
- Browser
- Download file 348 Bytes
-
https://huggingface.co/spaces/Aaravkumar/RAG-Chatbot/resolve/main/loader.py
- Command line
-
hf download hf://spaces/Aaravkumar/RAG-Chatbot/loader.py
-
curl -L -o loader.py https://huggingface.co/spaces/Aaravkumar/RAG-Chatbot/resolve/main/loader.py
348 Bytes
| import PyPDF2 | |
| class Loader: | |
| """ | |
| loads the text from the pdf files | |
| """ | |
| def __init__(self,file_path): | |
| self.file = file_path | |
| def load(self): | |
| reader = PyPDF2.PdfReader(self.file) | |
| text = "" | |
| for page in reader.pages: | |
| text = text + page.extract_text() | |
| return text |