Spaces:
Sleeping
Sleeping
Download src/utils/helpers.py from manhdo/VNPT_Smartbot: direct link, hf CLI and curl.
- Browser
- Download file 372 Bytes
-
https://huggingface.co/spaces/manhdo/VNPT_Smartbot/resolve/main/src/utils/helpers.py
- Command line
-
hf download hf://spaces/manhdo/VNPT_Smartbot/src/utils/helpers.py
-
curl -L -o helpers.py https://huggingface.co/spaces/manhdo/VNPT_Smartbot/resolve/main/src/utils/helpers.py
372 Bytes
| import base64 | |
| import os | |
| import random | |
| from pathlib import Path | |
| from typing import List | |
| def get_files_in_dir(path: Path) -> List[str]: | |
| files = [] | |
| for file in os.listdir(path): | |
| if os.path.isfile(os.path.join(path, file)): | |
| files.append(file) | |
| return files | |
| def get_random_img(img_names: List[str]) -> str: | |
| return random.choice(img_names) |