mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 21:50:28 +02:00
refactor: migrate remaining consumers to get_metadata API
Replace direct VOICES_INTERNAL imports with get_metadata('kokoro').voices:
- abogen/predownload_gui.py
- abogen/subtitle_utils.py
This commit is contained in:
@@ -21,7 +21,8 @@ from PyQt6.QtWidgets import (
|
||||
)
|
||||
from PyQt6.QtCore import QThread, pyqtSignal
|
||||
|
||||
from abogen.constants import COLORS, VOICES_INTERNAL
|
||||
from abogen.constants import COLORS
|
||||
from abogen.tts_backend_registry import get_metadata
|
||||
from abogen.spacy_utils import SPACY_MODELS
|
||||
import abogen.hf_tracker
|
||||
|
||||
@@ -114,7 +115,7 @@ class PreDownloadWorker(QThread):
|
||||
self._voices_success = False
|
||||
return
|
||||
|
||||
voice_list = VOICES_INTERNAL
|
||||
voice_list = get_metadata("kokoro").voices
|
||||
for idx, voice in enumerate(voice_list, start=1):
|
||||
if self._cancelled:
|
||||
self._voices_success = False
|
||||
@@ -462,14 +463,14 @@ class PreDownloadDialog(QDialog):
|
||||
try:
|
||||
from huggingface_hub import try_to_load_from_cache
|
||||
|
||||
for voice in VOICES_INTERNAL:
|
||||
for voice in get_metadata("kokoro").voices:
|
||||
if not try_to_load_from_cache(
|
||||
repo_id="hexgrad/Kokoro-82M", filename=f"voices/{voice}.pt"
|
||||
):
|
||||
missing.append(voice)
|
||||
except Exception:
|
||||
# If HF missing, report all as missing
|
||||
return False, list(VOICES_INTERNAL)
|
||||
return False, list(get_metadata("kokoro").voices)
|
||||
return (len(missing) == 0), missing
|
||||
|
||||
def _check_kokoro_model(self) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user