Spaces:
Build error
Build error
Create python
Browse files123456789101112131415161718192021import whisper
model = whisper.load_model("turbo")
# load audio and pad/trim it to fit 30 secondsaudio = whisper.load_audio("audio.mp3")audio = whisper.pad_or_trim(audio)
# make log-Mel spectrogram and move to the same device as the modelmel = whisper.log_mel_spectrogram(audio).to(model.device)
# detect the spoken language_, probs = model.detect_language(mel)print(f"Detected language: {max(probs, key=probs.get)}")
# decode the audiooptions = whisper.DecodingOptions()result = whisper.decode(model, mel, options)
# print the recognized textprint(result.text)pythonAdded+21