File size: 597 Bytes
93d849e 5d6bc67 93d849e 5d6bc67 93d849e 79348af 5d6bc67 79348af 5d6bc67 79348af d4d41ef |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import gradio as gr
import os
from transformers import pipeline
# Load ASR pipeline
asr = pipeline(task="automatic-speech-recognition",
model="distil-whisper/distil-small.en")
# Define function
def transcribe(audio):
out = asr(audio)
return out['text'] # Extract transcribed text
# Create Gradio Interface
iface = gr.Interface(fn=transcribe,
inputs=gr.Audio(type="filepath"), # Expect an audio file path
outputs="text")
# Launch Interface
iface.launch(share=True,
server_port=int(os.environ.get('PORT1', 7860)))
|