mirror of
https://github.com/DrewThomasson/ebook2audiobook.git
synced 2026-01-07 21:14:06 -05:00
Working Piper! Voice clone, no default select for no voice clone
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -130,7 +130,7 @@ class Coqui:
|
||||
try:
|
||||
if key in loaded_tts.keys():
|
||||
return loaded_tts[key]['engine']
|
||||
unload_tts(device, [self.tts_key, self.tts_vc_key])
|
||||
unload_tts(device, [self.tts_key, self.tts_vc_key], self.tts_key)
|
||||
with lock:
|
||||
# Download the model files if needed
|
||||
model_file, config_file = self._download_model(model_path)
|
||||
@@ -154,7 +154,7 @@ class Coqui:
|
||||
try:
|
||||
if key in loaded_tts.keys():
|
||||
return loaded_tts[key]['engine']
|
||||
unload_tts(device, [self.tts_vc_key])
|
||||
unload_tts(device, [self.tts_vc_key], self.tts_vc_key)
|
||||
with lock:
|
||||
try:
|
||||
from TTS.api import TTS as CoquiAPI # Lazy import to avoid hard dependency if not needed
|
||||
@@ -257,7 +257,7 @@ class Coqui:
|
||||
return loaded_tts[key]['engine']
|
||||
tts_engine = kwargs.get('tts_engine')
|
||||
device = kwargs.get('device')
|
||||
unload_tts(device, [self.tts_key])
|
||||
unload_tts(device, [self.tts_key], self.tts_key)
|
||||
with lock:
|
||||
checkpoint_dir = kwargs.get('checkpoint_dir')
|
||||
model_file = os.path.join(checkpoint_dir, 'model.onnx')
|
||||
|
||||
@@ -11,19 +11,25 @@ class TTSManager:
|
||||
|
||||
def _build(self)->None:
|
||||
if self.session['tts_engine'] in TTS_ENGINES.values():
|
||||
if self.session['tts_engine'] in [TTS_ENGINES['XTTSv2'],TTS_ENGINES['BARK'],TTS_ENGINES['VITS'],TTS_ENGINES['FAIRSEQ'],TTS_ENGINES['TACOTRON2'],TTS_ENGINES['YOURTTS']]:
|
||||
from lib.classes.tts_engines.coqui import Coqui
|
||||
self.engine = Coqui(self.session)
|
||||
elif self.session['tts_engine'] in [TTS_ENGINES['PIPER']]:
|
||||
from lib.classes.tts_engines.piper import Coqui
|
||||
self.tts = Coqui(self.session)
|
||||
#elif self.session['tts_engine'] in [TTS_ENGINES['NEW_TTS']]:
|
||||
# from lib.classes.tts_engines.new_tts import NewTts
|
||||
# self.engine = NewTts(self.session)
|
||||
if not self.engine.tts:
|
||||
self.engine = False
|
||||
error='TTS engine could not be created!'
|
||||
try:
|
||||
if self.session['tts_engine'] in [TTS_ENGINES['XTTSv2'],TTS_ENGINES['BARK'],TTS_ENGINES['VITS'],TTS_ENGINES['FAIRSEQ'],TTS_ENGINES['TACOTRON2'],TTS_ENGINES['YOURTTS']]:
|
||||
from lib.classes.tts_engines.coqui import Coqui
|
||||
self.engine = Coqui(self.session)
|
||||
elif self.session['tts_engine'] in [TTS_ENGINES['PIPER']]:
|
||||
from lib.classes.tts_engines.piper import Coqui as PiperCoqui
|
||||
self.engine = PiperCoqui(self.session)
|
||||
#elif self.session['tts_engine'] in [TTS_ENGINES['NEW_TTS']]:
|
||||
# from lib.classes.tts_engines.new_tts import NewTts
|
||||
# self.engine = NewTts(self.session)
|
||||
|
||||
# Check if engine was created successfully (not False)
|
||||
if self.engine is False:
|
||||
error='TTS engine could not be created!'
|
||||
print(error)
|
||||
except Exception as e:
|
||||
error = f'_build() error: {e}'
|
||||
print(error)
|
||||
self.engine = False
|
||||
else:
|
||||
print('Other TTS engines coming soon!')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user