Spaces:
Running
Running
Update download_model.py
Browse files- download_model.py +10 -7
download_model.py
CHANGED
|
@@ -7,7 +7,7 @@ import platform
|
|
| 7 |
|
| 8 |
# Repository ID
|
| 9 |
repo_id = "hexgrad/Kokoro-82M"
|
| 10 |
-
|
| 11 |
# Set up the cache directory
|
| 12 |
cache_dir = "./cache"
|
| 13 |
os.makedirs(cache_dir, exist_ok=True)
|
|
@@ -37,8 +37,8 @@ def get_voice_models():
|
|
| 37 |
"""Downloads missing voice models from the Hugging Face repository."""
|
| 38 |
|
| 39 |
# Create or empty the 'voices' directory
|
| 40 |
-
|
| 41 |
-
|
| 42 |
os.makedirs(VOICES_DIR, exist_ok=True)
|
| 43 |
|
| 44 |
# Get list of files from the repository
|
|
@@ -55,14 +55,17 @@ def get_voice_models():
|
|
| 55 |
if download_voice:
|
| 56 |
# print(f"Files to download: {download_voice}")
|
| 57 |
pass
|
| 58 |
-
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
def download_base_models():
|
| 62 |
"""Downloads Kokoro base model and fp16 version if missing."""
|
| 63 |
|
| 64 |
-
download_files(
|
| 65 |
-
download_files(
|
| 66 |
|
| 67 |
def setup_batch_file():
|
| 68 |
"""Creates a 'run_app.bat' file for Windows if it doesn't exist."""
|
|
|
|
| 7 |
|
| 8 |
# Repository ID
|
| 9 |
repo_id = "hexgrad/Kokoro-82M"
|
| 10 |
+
repo_id2="Remsky/kokoro-82m-mirror"
|
| 11 |
# Set up the cache directory
|
| 12 |
cache_dir = "./cache"
|
| 13 |
os.makedirs(cache_dir, exist_ok=True)
|
|
|
|
| 37 |
"""Downloads missing voice models from the Hugging Face repository."""
|
| 38 |
|
| 39 |
# Create or empty the 'voices' directory
|
| 40 |
+
if os.path.exists(VOICES_DIR):
|
| 41 |
+
shutil.rmtree(VOICES_DIR)
|
| 42 |
os.makedirs(VOICES_DIR, exist_ok=True)
|
| 43 |
|
| 44 |
# Get list of files from the repository
|
|
|
|
| 55 |
if download_voice:
|
| 56 |
# print(f"Files to download: {download_voice}")
|
| 57 |
pass
|
| 58 |
+
eng_voices = []
|
| 59 |
+
for i in download_voice:
|
| 60 |
+
if i.startswith("a") or i.startswith("b"):
|
| 61 |
+
eng_voices.append(i)
|
| 62 |
+
download_files(repo_id, [f"voices/{file}" for file in eng_voices], VOICES_DIR, cache_dir)
|
| 63 |
|
| 64 |
def download_base_models():
|
| 65 |
"""Downloads Kokoro base model and fp16 version if missing."""
|
| 66 |
|
| 67 |
+
download_files(repo_id2, [KOKORO_FILE], KOKORO_DIR, cache_dir)
|
| 68 |
+
download_files(repo_id2, [FP16_FILE], FP16_DIR, cache_dir)
|
| 69 |
|
| 70 |
def setup_batch_file():
|
| 71 |
"""Creates a 'run_app.bat' file for Windows if it doesn't exist."""
|