Spaces:
Running
on
Zero
Running
on
Zero
File size: 747 Bytes
ed71812 d0d0cf3 ed71812 d0d0cf3 ed71812 d0d0cf3 ed71812 45853c5 ed71812 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import gradio as gr
from transformers import pipeline
import spaces
# Load the Whisper model from Hugging Face
model = pipeline("automatic-speech-recognition", model="ylacombe/whisper-large-v3-turbo", chunk_length_s=30, device=0)
# Function to process audio input and transcribe it
@spaces.GPU
def transcribe(audio):
# Load and preprocess the audio
transcription = model(audio,batch_size=1000, generate_kwargs={"task": "transcribe"}, return_timestamps=True)["text"]
return transcription
# Gradio interface
interface = gr.Interface(
fn=transcribe,
inputs=gr.Audio(sources="microphone", type="filepath"),
outputs="text",
title="Whisper Voice Transcription with Hugging Face"
)
# Launch the app
interface.launch()
|