This commit is contained in:
Saifeddine ALOUI 2024-09-20 01:53:09 +02:00
parent c4ecf825b6
commit 536f3cfa66
2 changed files with 9 additions and 2 deletions

View File

@ -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

View File

@ -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 []