File size: 1,255 Bytes
89a8916
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python3
"""
Download all required TTS models from HuggingFace
Run this on deployment to fetch models before starting the server
"""

import os
import sys

# Add src to path
sys.path.insert(0, os.path.dirname(__file__))

from src.downloader import ModelDownloader
from src.config import LANGUAGE_CONFIGS


def main():
    print("=" * 60)
    print("Downloading TTS Models from HuggingFace...")
    print("=" * 60)

    downloader = ModelDownloader()

    # Download all configured models
    voices = list(LANGUAGE_CONFIGS.keys())
    print(f"\nModels to download: {len(voices)}")
    for v in voices:
        print(f"  - {v}")

    print("\n")

    success = 0
    failed = []

    for voice in voices:
        try:
            print(f"Downloading {voice}...")
            downloader.download_model(voice)
            success += 1
            print(f"  ✓ {voice} downloaded\n")
        except Exception as e:
            print(f"  ✗ {voice} failed: {e}\n")
            failed.append(voice)

    print("=" * 60)
    print(f"Download complete: {success}/{len(voices)} models")
    if failed:
        print(f"Failed: {', '.join(failed)}")
        return 1
    print("=" * 60)
    return 0


if __name__ == "__main__":
    sys.exit(main())