Tashuu's picture
Create app.py
bb248bf verified
raw
history blame contribute delete
793 Bytes
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()