File size: 950 Bytes
287c28c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import subprocess
import os

# languages = ["as", "bn", "brx", "en+hi", "en", "gu", "hi", "kn", "ml", "mni", "mr", "or", "pa", "raj", "ta", "te"]
languages = ["as", "hi", "ta"]
base_url = "https://github.com/AI4Bharat/Indic-TTS/releases/download/v1-checkpoints-release"

def download_and_extract(lang):
    if (os.path.exists(f"Indic-TTS/models")):
        print(f"Directory Indic-TTS/models exists")
    else:
        print(f"Creating directory Indic-TTS/models")
        os.makedirs(f"Indic-TTS/models")
    os.chdir(f"Indic-TTS/models")
    print(f"Downloading and extracting {lang}.zip...")
    # Run the download and extraction commands, stream output in real-time
    subprocess.run(f"wget {base_url}/{lang}.zip", shell=True, check=True)
    subprocess.run(f"unzip -o {lang}.zip", shell=True, check=True)
    subprocess.run(f"rm {lang}.zip", shell=True, check=True)

download_and_extract("hi")

print("All languages downloaded and extracted.")