Spaces:
Runtime error
Runtime error
Download preprocess/tools/note_transcription/utils/os_utils.py from Surunrun/SoulX-Singer: direct link, hf CLI and curl.
- Browser
- Download file 537 Bytes
-
https://huggingface.co/spaces/Surunrun/SoulX-Singer/resolve/main/preprocess/tools/note_transcription/utils/os_utils.py
- Command line
-
hf download hf://spaces/Surunrun/SoulX-Singer/preprocess/tools/note_transcription/utils/os_utils.py
-
curl -L -o os_utils.py https://huggingface.co/spaces/Surunrun/SoulX-Singer/resolve/main/preprocess/tools/note_transcription/utils/os_utils.py
537 Bytes
| import os | |
| import subprocess | |
| from pathlib import Path | |
| def link_file(from_file, to_file): | |
| subprocess.check_call( | |
| f'ln -s "`realpath --relative-to="{os.path.dirname(to_file)}" "{from_file}"`" "{to_file}"', shell=True) | |
| def move_file(from_file, to_file): | |
| subprocess.check_call(f'mv "{from_file}" "{to_file}"', shell=True) | |
| def copy_file(from_file, to_file): | |
| subprocess.check_call(f'cp -r "{from_file}" "{to_file}"', shell=True) | |
| def safe_path(path): | |
| os.makedirs(Path(path).parent, exist_ok=True) | |
| return path | |