Spaces:
No application file
No application file
Download setup_tools/commands.py from mrtroydev/audio-webui: direct link, hf CLI and curl.
- Browser
- Download file 708 Bytes
-
https://huggingface.co/spaces/mrtroydev/audio-webui/resolve/main/setup_tools/commands.py
- Command line
-
hf download hf://spaces/mrtroydev/audio-webui/setup_tools/commands.py
-
curl -L -o commands.py https://huggingface.co/spaces/mrtroydev/audio-webui/resolve/main/setup_tools/commands.py
708 Bytes
| import sys | |
| from os import system | |
| from setup_tools.os import is_windows | |
| def get_python(): | |
| return sys.executable | |
| def run_command(command: list[tuple[str, str]] | str, args='', show_output=True): | |
| extra = (' >nul' if is_windows() else ' >/dev/null') if not show_output else '' | |
| if not isinstance(command, str): | |
| commandstr = '&&'.join([' '.join(cmd) + extra for cmd in command]) | |
| else: | |
| commandstr = f'{command} {args}' + extra | |
| # Ensure bin/bash shell | |
| if not is_windows(): | |
| commandstr = f'/usr/bin/env bash -c "{commandstr}"' | |
| system(commandstr) | |
| def run_pip(package, show_output=False): | |
| run_command('pip', f'install {package}', show_output) | |