Spaces:
Sleeping
Sleeping
File size: 449 Bytes
d7aa11b 05e9e3a c575d84 f3c7107 05e9e3a c575d84 05e9e3a c575d84 05e9e3a f3c7107 d7aa11b 05e9e3a 5046c96 d7aa11b f3c7107 d7aa11b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
from transformers import pipeline
import soundfile as sf
asr_model = pipeline("automatic-speech-recognition", model="openai/whisper-small")
def transcribe(audio_file):
with audio_file as f:
data, samplerate = sf.read(f.name)
transcription = asr_model(data, samplerate=samplerate)
return transcription["text"]
iface = gr.Interface(
fn=transcribe,
inputs="audio",
outputs="text"
)
iface.launch() |