This repository has been archived by the owner on Feb 8, 2025. It is now read-only.
forked from suno-ai/bark
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- BUGFIX: Joining prompt names in subfolders
- Release with Windows Installer - Installer .bat includes automatic updater - Trying to detect voice changes, adding short pause breaks inbetween
- Loading branch information
1 parent
9f3d100
commit 64a7123
Showing
5 changed files
with
188 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import argparse | ||
import glob | ||
import os | ||
import shutil | ||
import site | ||
import subprocess | ||
import sys | ||
|
||
script_dir = os.getcwd() | ||
|
||
|
||
def run_cmd(cmd, capture_output=False, env=None): | ||
# Run shell commands | ||
return subprocess.run(cmd, shell=True, capture_output=capture_output, env=env) | ||
|
||
|
||
def check_env(): | ||
# If we have access to conda, we are probably in an environment | ||
conda_not_exist = run_cmd("conda", capture_output=True).returncode | ||
if conda_not_exist: | ||
print("Conda is not installed. Exiting...") | ||
sys.exit() | ||
|
||
# Ensure this is a new environment and not the base environment | ||
if os.environ["CONDA_DEFAULT_ENV"] == "base": | ||
print("Create an environment for this project and activate it. Exiting...") | ||
sys.exit() | ||
|
||
|
||
def install_dependencies(): | ||
# Select your GPU or, choose to run in CPU mode | ||
print("Do you have a GPU (Nvidia)?") | ||
print("Enter Y for Yes") | ||
print() | ||
gpuchoice = input("Input> ").lower() | ||
|
||
# Clone webui to our computer | ||
run_cmd("git clone https://github.com/C0untFloyd/bark-gui.git") | ||
if gpuchoice == "y": | ||
run_cmd("pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118") | ||
|
||
run_cmd("pip install IPython") | ||
run_cmd("pip install soundfile") | ||
run_cmd("pip install gradio") | ||
# Install the webui dependencies | ||
update_dependencies() | ||
|
||
|
||
def update_dependencies(): | ||
os.chdir("bark-gui") | ||
run_cmd("git pull") | ||
# Installs/Updates dependencies from all requirements.txt | ||
run_cmd("python -m pip install .") | ||
|
||
|
||
def start_app(): | ||
os.chdir("bark-gui") | ||
run_cmd('python webui.py -autolaunch') | ||
|
||
|
||
if __name__ == "__main__": | ||
# Verifies we are in a conda environment | ||
check_env() | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--update', action='store_true', help='Update the web UI.') | ||
args = parser.parse_args() | ||
|
||
if args.update: | ||
update_dependencies() | ||
else: | ||
# If webui has already been installed, skip and run | ||
if not os.path.exists("bark-gui/"): | ||
install_dependencies() | ||
os.chdir(script_dir) | ||
|
||
# Run the model with webui | ||
start_app() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
@echo off | ||
|
||
cd /D "%~dp0" | ||
|
||
echo "%CD%"| findstr /C:" " >nul && echo This script relies on Miniconda which can not be silently installed under a path with spaces. && goto end | ||
|
||
set PATH=%PATH%;%SystemRoot%\system32 | ||
|
||
@rem config | ||
set INSTALL_DIR=%cd%\installer_files | ||
set CONDA_ROOT_PREFIX=%cd%\installer_files\conda | ||
set INSTALL_ENV_DIR=%cd%\installer_files\env | ||
set MINICONDA_DOWNLOAD_URL=https://repo.anaconda.com/miniconda/Miniconda3-py310_23.1.0-1-Windows-x86_64.exe | ||
set conda_exists=F | ||
|
||
@rem figure out whether git and conda needs to be installed | ||
call "%CONDA_ROOT_PREFIX%\_conda.exe" --version >nul 2>&1 | ||
if "%ERRORLEVEL%" EQU "0" set conda_exists=T | ||
|
||
@rem (if necessary) install git and conda into a contained environment | ||
@rem download conda | ||
if "%conda_exists%" == "F" ( | ||
echo Downloading Miniconda from %MINICONDA_DOWNLOAD_URL% to %INSTALL_DIR%\miniconda_installer.exe | ||
|
||
mkdir "%INSTALL_DIR%" | ||
call curl -Lk "%MINICONDA_DOWNLOAD_URL%" > "%INSTALL_DIR%\miniconda_installer.exe" || ( echo. && echo Miniconda failed to download. && goto end ) | ||
|
||
echo Installing Miniconda to %CONDA_ROOT_PREFIX% | ||
start /wait "" "%INSTALL_DIR%\miniconda_installer.exe" /InstallationType=JustMe /NoShortcuts=1 /AddToPath=0 /RegisterPython=0 /NoRegistry=1 /S /D=%CONDA_ROOT_PREFIX% | ||
|
||
@rem test the conda binary | ||
echo Miniconda version: | ||
call "%CONDA_ROOT_PREFIX%\_conda.exe" --version || ( echo. && echo Miniconda not found. && goto end ) | ||
) | ||
|
||
@rem create the installer env | ||
if not exist "%INSTALL_ENV_DIR%" ( | ||
echo Packages to install: %PACKAGES_TO_INSTALL% | ||
call "%CONDA_ROOT_PREFIX%\_conda.exe" create --no-shortcuts -y -k --prefix "%INSTALL_ENV_DIR%" python=3.10 || ( echo. && echo Conda environment creation failed. && goto end ) | ||
) | ||
|
||
@rem check if conda environment was actually created | ||
if not exist "%INSTALL_ENV_DIR%\python.exe" ( echo. && echo Conda environment is empty. && goto end ) | ||
|
||
@rem activate installer env | ||
call "%CONDA_ROOT_PREFIX%\condabin\conda.bat" activate "%INSTALL_ENV_DIR%" || ( echo. && echo Miniconda hook not found. && goto end ) | ||
|
||
@rem always ask for update check | ||
if "%conda_exists%" == "T" ( | ||
choice /C:YN /M:"Check for Updates" | ||
IF ERRORLEVEL == 1 ( | ||
echo Checking... | ||
call python installer.py --update | ||
) | ||
) | ||
|
||
@rem setup installer env | ||
echo Launching Bark GUI | ||
call python installer.py | ||
|
||
echo. | ||
echo Done! | ||
|
||
:end | ||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters