Run PhoWhisper models using Hugging Face Transformers
mainYou can use PhoWhisper for Vietnamese automatic speech recognition by loading the models via the Hugging Face transformers library. The models are compatible with the automatic-speech-recognition pipeline.
Note: Ensure your input audio files have a sampling rate of 16kHz.
from transformers import pipeline
# Initialize the transcriber with a PhoWhisper model
transcriber = pipeline("automatic-speech-recognition", model="vinai/PhoWhisper-small")
# Run transcription on an audio file (must be 16kHz)
output = transcriber(path_to_audio_with_sampling_rate_16kHz)['text']