diff --git a/lollms/app.py b/lollms/app.py index 7484bf0..8cb9e16 100644 --- a/lollms/app.py +++ b/lollms/app.py @@ -550,6 +550,9 @@ class LollmsApplication(LoLLMsCom): elif self.config.active_tts_service == "openai_tts" and (self.tts is None or self.tts.name!="openai_tts"): from lollms.services.tts.open_ai_tts.lollms_openai_tts import LollmsOpenAITTS self.tts = LollmsOpenAITTS(self, self.config.openai_tts_model, self.config.openai_tts_voice, self.config.openai_tts_key) + elif self.config.active_tts_service == "fish_tts": + from lollms.services.tts.fish.lollms_fish_tts import LollmsFishAudioTTS + self.tts = LollmsFishAudioTTS(self, self.config.fish_tts_voice, self.config.fish_tts_key) elif self.config.active_tts_service == "xtts" and self.xtts: self.tts = self.xtts diff --git a/lollms/services/tts/fish/lollms_fish_tts.py b/lollms/services/tts/fish/lollms_fish_tts.py index e5687eb..0dfefc3 100644 --- a/lollms/services/tts/fish/lollms_fish_tts.py +++ b/lollms/services/tts/fish/lollms_fish_tts.py @@ -1,7 +1,6 @@ from pathlib import Path from typing import List, Dict, Any import httpx -import ormsgpack from pydantic import BaseModel from lollms.app import LollmsApplication from lollms.paths import LollmsPaths @@ -13,6 +12,11 @@ if not PackageManager.check_package_installed("sounddevice"): if not PackageManager.check_package_installed("soundfile"): PackageManager.install_package("soundfile") +if not PackageManager.check_package_installed("ormsgpack"): + PackageManager.install_package("ormsgpack") + +import ormsgpack + import sounddevice as sd import soundfile as sf @@ -81,7 +85,7 @@ class LollmsFishAudioTTS(LollmsTTS): def tts_file(self, text, file_name_or_path: Path | str = None, speaker=None, language="en", use_threading=False): speech_file_path = Path(file_name_or_path) if file_name_or_path else self._get_output_path("mp3") - reference = self._get_reference_audio(self.voice_name) + reference = self._get_reference_audio(speaker) request = ServeTTSRequest( text=text, references=[reference] if reference else []