Spaces:
Runtime error
Runtime error
Download src/utils/common.py from RDeepak/RAG-Embedding-Search-EPs: direct link, hf CLI and curl.
- Browser
- Download file 706 Bytes
-
https://huggingface.co/spaces/RDeepak/RAG-Embedding-Search-EPs/resolve/main/src/utils/common.py
- Command line
-
hf download hf://spaces/RDeepak/RAG-Embedding-Search-EPs/src/utils/common.py
-
curl -L -o common.py https://huggingface.co/spaces/RDeepak/RAG-Embedding-Search-EPs/resolve/main/src/utils/common.py
706 Bytes
| import os | |
| import yaml | |
| import sys | |
| from src.exception import CustomException | |
| def make_dirs(dirs:list[str]): | |
| try: | |
| for dir in dirs: | |
| os.makedirs(dir, exist_ok=True) | |
| except Exception as e: | |
| raise CustomException(e, sys) | |
| def make_files(files:list[str]): | |
| try: | |
| for file in files: | |
| with open(file, 'w') as f: | |
| f.close() | |
| except Exception as e: | |
| raise CustomException(e, sys) | |
| def read_yml(filepath:str): | |
| try: | |
| with open(filepath, 'r') as file: | |
| filedata = yaml.safe_load(file) | |
| file.close() | |
| return filedata | |
| except Exception as e: | |
| raise CustomException(e, sys) | |