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="DrishtiSharma/whisper-large-v2-marathi") 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()