Spaces:
Running
Running
File size: 920 Bytes
305c59b 49d93f9 305c59b 49d93f9 305c59b 49d93f9 305c59b 49d93f9 305c59b 49d93f9 305c59b 49d93f9 |
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 |
import gradio as gr
from transformers import pipeline
# Load the Whisper model for speech recognition
model = pipeline("automatic-speech-recognition", model="openai/whisper-medium")
def transcribe_audio(audio_file, language="english"):
# Transcribe the audio file
transcription = model(audio_file, generate_kwargs={"language": language})
return transcription["text"]
# Define the Gradio interface
iface = gr.Interface(
fn=transcribe_audio,
inputs=[
gr.Audio(type="filepath", label="Upload Audio File"),
gr.Dropdown(choices=["english", "spanish", "french", "german", "chinese", "japanese", "korean", "hindi"], label="Select Language", value="english")
],
outputs=gr.Textbox(label="Transcription"),
title="Multi-Language Audio Transcription",
description="Upload an audio file and select the language to transcribe it."
)
# Launch the Gradio interface
iface.launch() |