import whisperx | |
audio_path = "audio_cut/4.wav" | |
device = "cuda" | |
batch_size = 4 # reduce if low on GPU mem | |
compute_type = "float32" # change to "int8" if low on GPU mem (may reduce accuracy) | |
# 1. Transcribe with original whisper (batched) | |
model_dir = "figures/" | |
model = whisperx.load_model("medium", device, compute_type=compute_type, download_root=model_dir,language="vi") | |
audio = whisperx.load_audio(audio_path) | |
result = model.transcribe(audio, batch_size=batch_size,chunk_size=10 | |
) | |
print(result) | |
import json | |
# with open('data.json', 'w', encoding='utf-8') as json_file: | |
# json.dump(data, json_file, ensure_ascii=False, indent=4) | |