File size: 676 Bytes
3342236 8b4d9a3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import os
import subprocess
MODEL_PATH = "model"
MODEL_URL = "https://huggingface.co/vosk-models/vosk-small-en-us/resolve/main"
# Danh sách file cần tải
files = ["am", "conf", "graph", "ivector", "rescore"]
if not os.path.exists(MODEL_PATH):
os.makedirs(MODEL_PATH)
for file in files:
file_url = f"{MODEL_URL}/{file}.zip"
file_path = os.path.join(MODEL_PATH, f"{file}.zip")
if not os.path.exists(file_path):
print(f"Đang tải {file_url} ...")
subprocess.run(["wget", "-O", file_path, file_url])
subprocess.run(["unzip", "-o", file_path, "-d", MODEL_PATH])
os.remove(file_path)
print("Tải model thành công!") |