slseanwu/clotho-chatgpt-mixup-50K
Updated • 52 • 3
How to use espnet/DCASE23.AudioCaptioning.PreTrained with ESPnet:
from espnet2.bin.asr_inference import Speech2Text
model = Speech2Text.from_pretrained(
"espnet/DCASE23.AudioCaptioning.PreTrained"
)
speech, rate = soundfile.read("speech.wav")
text, *_ = model(speech)[0]import librosa
from espnet2.bin.asr_inference import Speech2Text
speech2text = Speech2Text.from_pretrained(model_tag="espnet/DCASE23.AudioCaptioning.PreTrained")
# librosa resamples and mixes to one channel, so any file works; 16000 is
# what nearly every espnet recogniser is trained on - check this model's
# config if its audio is not 16 kHz
speech, rate = librosa.load("audio.wav", sr=16000, mono=True)
text, *_ = speech2text(speech)[0]
print(text)