Spaces:
Sleeping
Sleeping
Download app/utils/document_op.py from Kshitijk20/ClariDoc: direct link, hf CLI and curl.
- Browser
- Download file 417 Bytes
-
https://huggingface.co/spaces/Kshitijk20/ClariDoc/resolve/main/app/utils/document_op.py
- Command line
-
hf download hf://spaces/Kshitijk20/ClariDoc/app/utils/document_op.py
-
curl -L -o document_op.py https://huggingface.co/spaces/Kshitijk20/ClariDoc/resolve/main/app/utils/document_op.py
417 Bytes
| import os | |
| class DocumentOperation: | |
| def get_file_type_by_extension(filename): | |
| _, extension = os.path.splitext(filename) | |
| extension = extension.lower() | |
| if extension == ".txt": | |
| return "text" | |
| elif extension == ".pdf": | |
| return "pdf" | |
| elif extension in [".doc", ".docx"]: | |
| return "word" | |
| else: | |
| return "unknown" |