add back setup routine
This commit is contained in:
1 parent
5a81e4818b
commit
1b4e982955
1 file changed
+24
-10
@@ -27,7 +27,6 @@ deepspeed_available = False
|
|||||||
# In this section you will import any imports that your specific TTS Engine will use. You will provide any
|
# In this section you will import any imports that your specific TTS Engine will use. You will provide any
|
||||||
# start-up errors for those bits, as if you were starting up a normal Python script. Note the logging.disable
|
# start-up errors for those bits, as if you were starting up a normal Python script. Note the logging.disable
|
||||||
# a few lines up from here, you may want to # that out while debugging!
|
# a few lines up from here, you may want to # that out while debugging!
|
||||||
from vocos import Vocos
|
|
||||||
import soundfile as sf
|
import soundfile as sf
|
||||||
import tempfile
|
import tempfile
|
||||||
from pydub import AudioSegment, silence
|
from pydub import AudioSegment, silence
|
||||||
@@ -39,9 +38,22 @@ import sys
|
|||||||
|
|
||||||
def install_and_restart():
|
def install_and_restart():
|
||||||
try:
|
try:
|
||||||
print("##########################################")
|
print("#################################################################")
|
||||||
print("F5-TTS not found. Attempting to install...")
|
print("Installing required packages for F5-TTS... This may take a while.")
|
||||||
print("##########################################")
|
print("################################################################")
|
||||||
|
|
||||||
|
# Install vocos first
|
||||||
|
print("Installing vocos...")
|
||||||
|
subprocess.check_call([
|
||||||
|
sys.executable,
|
||||||
|
"-m",
|
||||||
|
"pip",
|
||||||
|
"install",
|
||||||
|
"vocos"
|
||||||
|
])
|
||||||
|
|
||||||
|
# Then install F5-TTS
|
||||||
|
print("Installing F5-TTS...")
|
||||||
subprocess.check_call([
|
subprocess.check_call([
|
||||||
sys.executable,
|
sys.executable,
|
||||||
"-m",
|
"-m",
|
||||||
@@ -49,9 +61,10 @@ def install_and_restart():
|
|||||||
"install",
|
"install",
|
||||||
"git+https://github.com/SWivid/F5-TTS.git"
|
"git+https://github.com/SWivid/F5-TTS.git"
|
||||||
])
|
])
|
||||||
print("########################################################")
|
|
||||||
print("F5-TTS installed successfully! Restarting application...")
|
print("##############################################################")
|
||||||
print("########################################################")
|
print("All packages installed successfully! Restarting application...")
|
||||||
|
print("##############################################################")
|
||||||
|
|
||||||
# Get the current script's path
|
# Get the current script's path
|
||||||
script_path = sys.argv[0]
|
script_path = sys.argv[0]
|
||||||
@@ -61,16 +74,17 @@ def install_and_restart():
|
|||||||
|
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print("########################################################")
|
print("########################################################")
|
||||||
print(f"Failed to install F5-TTS: {str(e)}")
|
print(f"Failed to install required packages: {str(e)}")
|
||||||
print("########################################################")
|
print("########################################################")
|
||||||
raise ImportError("Could not install required package F5-TTS")
|
raise ImportError("Could not install required packages")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from f5_tts.model import CFM, DiT, UNetT
|
from f5_tts.model import CFM, DiT
|
||||||
from f5_tts.model.utils import (
|
from f5_tts.model.utils import (
|
||||||
get_tokenizer,
|
get_tokenizer,
|
||||||
convert_char_to_pinyin,
|
convert_char_to_pinyin,
|
||||||
)
|
)
|
||||||
|
from vocos import Vocos
|
||||||
except ImportError:
|
except ImportError:
|
||||||
install_and_restart()
|
install_and_restart()
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user