Spaces:
Sleeping
Sleeping
import gradio as gr | |
from transformers import pipeline | |
import numpy as np | |
def recognize_speech(audio): | |
print (type(audio)) | |
transcriber = pipeline("automatic-speech-recognition", model="openai/whisper-base.en") | |
sr, y = audio | |
y = y.astype(np.float32) | |
y /= np.max(np.abs(y)) | |
return transcriber({"sampling_rate": sr, "raw": y})["text"] | |
gr.close_all() | |
demo = gr.Interface(fn=recognize_speech, inputs="audio", outputs="text") | |
demo.launch() |