Update Modules/Generate_Speech.py
Browse files
Modules/Generate_Speech.py
CHANGED
|
@@ -68,8 +68,8 @@ def _init_kokoro() -> None:
|
|
| 68 |
device = "cuda"
|
| 69 |
except Exception:
|
| 70 |
device = "cpu"
|
| 71 |
-
model = KModel().to(device).eval()
|
| 72 |
-
pipelines = {"a": KPipeline(lang_code="a", model=False)}
|
| 73 |
try:
|
| 74 |
pipelines["a"].g2p.lexicon.golds["kokoro"] = "kˈOkəɹO"
|
| 75 |
except Exception:
|
|
@@ -169,7 +169,7 @@ def build_interface() -> gr.Interface:
|
|
| 169 |
info="Select from 54 available voices across multiple languages and accents",
|
| 170 |
),
|
| 171 |
],
|
| 172 |
-
outputs=gr.Audio(label="Audio", type="numpy", format="wav",
|
| 173 |
title="Generate Speech",
|
| 174 |
description=(
|
| 175 |
"<div style=\"text-align:center\">Generate speech with Kokoro-82M. Supports multiple languages and accents. Runs on CPU or CUDA if available.</div>"
|
|
|
|
| 68 |
device = "cuda"
|
| 69 |
except Exception:
|
| 70 |
device = "cpu"
|
| 71 |
+
model = KModel(repo_id="hexgrad/Kokoro-82M").to(device).eval()
|
| 72 |
+
pipelines = {"a": KPipeline(lang_code="a", model=False, repo_id="hexgrad/Kokoro-82M")}
|
| 73 |
try:
|
| 74 |
pipelines["a"].g2p.lexicon.golds["kokoro"] = "kˈOkəɹO"
|
| 75 |
except Exception:
|
|
|
|
| 169 |
info="Select from 54 available voices across multiple languages and accents",
|
| 170 |
),
|
| 171 |
],
|
| 172 |
+
outputs=gr.Audio(label="Audio", type="numpy", format="wav", buttons=["download"]),
|
| 173 |
title="Generate Speech",
|
| 174 |
description=(
|
| 175 |
"<div style=\"text-align:center\">Generate speech with Kokoro-82M. Supports multiple languages and accents. Runs on CPU or CUDA if available.</div>"
|