Spaces:
Runtime error
Runtime error
Commit Β·
ef55711
1
Parent(s): 6e14842
Pre-download all the models
Browse filesPre-download all the models, using Repository from huggingface_hub
app.py
CHANGED
|
@@ -9,11 +9,14 @@ from typing import cast
|
|
| 9 |
|
| 10 |
import gradio as gr
|
| 11 |
from balacoon_tts import TTS
|
| 12 |
-
from huggingface_hub import
|
| 13 |
|
| 14 |
# global tts module, initialized from a model selected
|
| 15 |
tts = None
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
def main():
|
| 19 |
logging.basicConfig(level=logging.INFO)
|
|
@@ -40,7 +43,7 @@ def main():
|
|
| 40 |
|
| 41 |
with gr.Row():
|
| 42 |
with gr.Column(variant="panel"):
|
| 43 |
-
repo_files =
|
| 44 |
model_files = [x for x in repo_files if x.endswith("_cpu.addon")]
|
| 45 |
model_name = gr.Dropdown(
|
| 46 |
label="Model",
|
|
@@ -55,9 +58,7 @@ def main():
|
|
| 55 |
re-initializes tts object, gets list of
|
| 56 |
speakers that model supports and set them to `speaker`
|
| 57 |
"""
|
| 58 |
-
model_path =
|
| 59 |
-
repo_id="balacoon/tts", filename=model_name_str
|
| 60 |
-
)
|
| 61 |
global tts
|
| 62 |
tts = TTS(model_path)
|
| 63 |
speakers = tts.get_speakers()
|
|
|
|
| 9 |
|
| 10 |
import gradio as gr
|
| 11 |
from balacoon_tts import TTS
|
| 12 |
+
from huggingface_hub import Repository
|
| 13 |
|
| 14 |
# global tts module, initialized from a model selected
|
| 15 |
tts = None
|
| 16 |
+
model_repo_dir = "models"
|
| 17 |
+
model_repo = Repository(
|
| 18 |
+
local_dir=model_repo_dir, clone_from="balacoon/tts"
|
| 19 |
+
)
|
| 20 |
|
| 21 |
def main():
|
| 22 |
logging.basicConfig(level=logging.INFO)
|
|
|
|
| 43 |
|
| 44 |
with gr.Row():
|
| 45 |
with gr.Column(variant="panel"):
|
| 46 |
+
repo_files = glob.glob(os.path.join(model_repo_dir, "*.addon"))
|
| 47 |
model_files = [x for x in repo_files if x.endswith("_cpu.addon")]
|
| 48 |
model_name = gr.Dropdown(
|
| 49 |
label="Model",
|
|
|
|
| 58 |
re-initializes tts object, gets list of
|
| 59 |
speakers that model supports and set them to `speaker`
|
| 60 |
"""
|
| 61 |
+
model_path = os.path.join(model_repo_dir, model_name_str)
|
|
|
|
|
|
|
| 62 |
global tts
|
| 63 |
tts = TTS(model_path)
|
| 64 |
speakers = tts.get_speakers()
|