Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,7 +23,8 @@ def _init_kokoro() -> None:
|
|
| 23 |
if KModel is None or KPipeline is None:
|
| 24 |
raise gr.Error("Kokoro is not installed. Please add 'kokoro>=0.9.4' and 'torch' to requirements and install.")
|
| 25 |
|
| 26 |
-
device = "cpu"
|
|
|
|
| 27 |
model = KModel().to(device).eval()
|
| 28 |
pipelines = {"a": KPipeline(lang_code="a", model=False)}
|
| 29 |
try:
|
|
@@ -141,7 +142,7 @@ def generate_tts(text: str, speed: float, voice: str):
|
|
| 141 |
|
| 142 |
|
| 143 |
with gr.Blocks(theme='Nymbo/Nymbo_Theme') as demo:
|
| 144 |
-
gr.HTML("<h1 style='text-align: center;'>TTS
|
| 145 |
|
| 146 |
available_voices = get_kokoro_voices()
|
| 147 |
default_kokoro_voice = (
|
|
|
|
| 23 |
if KModel is None or KPipeline is None:
|
| 24 |
raise gr.Error("Kokoro is not installed. Please add 'kokoro>=0.9.4' and 'torch' to requirements and install.")
|
| 25 |
|
| 26 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 27 |
+
print(f"Using device: {device}")
|
| 28 |
model = KModel().to(device).eval()
|
| 29 |
pipelines = {"a": KPipeline(lang_code="a", model=False)}
|
| 30 |
try:
|
|
|
|
| 142 |
|
| 143 |
|
| 144 |
with gr.Blocks(theme='Nymbo/Nymbo_Theme') as demo:
|
| 145 |
+
gr.HTML("<h1 style='text-align: center;'>Kokoro-TTS</h1><p style='text-align: center;'>Powered by Kokoro-82M on CPU</p>")
|
| 146 |
|
| 147 |
available_voices = get_kokoro_voices()
|
| 148 |
default_kokoro_voice = (
|