Spaces:
Sleeping
Sleeping
File size: 793 Bytes
bb248bf |
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 27 28 |
import gradio as gr
from transformers import pipeline
# Load the Whisper model for Hindi transcription
pipe = pipeline(model="Tashuu/whisper-medium-hindi")
def transcribe_audio(audio):
"""
Transcribes the uploaded audio file using the fine-tuned Whisper model.
"""
try:
transcription = pipe(audio)["text"]
return transcription
except Exception as e:
return f"Error during transcription: {str(e)}"
# Define the Gradio interface
interface = gr.Interface(
fn=transcribe_audio,
inputs=gr.Audio(type="filepath"),
outputs="text",
title="Hindi Speech-to-Text Transcription",
description="Upload an audio file in Hindi, and this app will transcribe it to text using a fine-tuned Whisper model."
)
# Launch the app
interface.launch()
|