aboutsummaryrefslogtreecommitdiff
path: root/app/converter/converter.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/converter/converter.py')
-rw-r--r--app/converter/converter.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/app/converter/converter.py b/app/converter/converter.py
index 4c1ffad..5f67f4a 100644
--- a/app/converter/converter.py
+++ b/app/converter/converter.py
@@ -142,7 +142,8 @@ class AudiobookConverter:
voice: Optional[str] = None, debug: bool = False,
model_id: Optional[str] = None,
instructions: Optional[str] = None,
- request_options: Optional[Dict[str, str]] = None):
+ request_options: Optional[Dict[str, str]] = None,
+ api_url: Optional[str] = None):
if speed <= 0:
raise ValueError(f"Speed must be a positive number, got {speed}")
if output_format not in AUDIO_FORMATS:
@@ -171,7 +172,7 @@ class AudiobookConverter:
if backend == BACKEND_FASTER:
# The faster backend always voice-clones using a reference voice
# configured on the server, so no local reference audio is needed.
- self.tts = FasterTTSClient(voice=voice)
+ self.tts = FasterTTSClient(voice=voice, api_url=api_url)
elif backend == BACKEND_AUDIOCPP:
# Speaker mode (no voice) uses a built-in CustomVoice speaker;
# an explicit voice selects a server-side preset (cloning).
@@ -181,7 +182,8 @@ class AudiobookConverter:
self.tts = AudioCppTTSClient(voice=voice, language=self.language,
model_id=model_id,
instructions=instructions,
- request_options=self.request_options)
+ request_options=self.request_options,
+ api_url=api_url)
else:
self.tts = QwenTTSClient(
voice_mode=voice_mode,
@@ -189,6 +191,7 @@ class AudiobookConverter:
voice_clone_ref_text=voice_clone_ref_text,
skip_transcription=skip_transcription,
language=self.language,
+ api_url=api_url,
)
def _validate_configuration(self) -> None:
@@ -585,8 +588,11 @@ class AudiobookConverter:
print(f"Request options: {self.request_options}")
print(f"Language: {self.language}")
else:
- api_url = (config.CLONE_API_URL if self.voice_mode == VOICE_MODE_CLONE
- else config.QWEN_API_URL)
+ tts_client = getattr(self, "tts", None)
+ api_url = (getattr(tts_client, "api_url", None)
+ or (config.CLONE_API_URL
+ if self.voice_mode == VOICE_MODE_CLONE
+ else config.QWEN_API_URL))
print(f"Qwen API endpoint: {api_url}")
print(f"Voice mode: {self.voice_mode}")
print(f"Model size: {MODEL_SIZE} (always)")