Spaces:
Sleeping
Sleeping
File size: 1,217 Bytes
e4a47df 94a45e7 38ac6d0 94a45e7 e4a47df 94a45e7 fcb7844 94a45e7 38ac6d0 e4a47df 38ac6d0 17e2543 38ac6d0 be060a8 38ac6d0 e4a47df | 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 29 30 31 32 33 34 35 36 37 38 39 40 | import gradio as gr
import nemo.collections.asr as nemo_asr
from nemo.collections.asr.models import ASRModel
import os
from huggingface_hub import hf_hub_download
# Download model from private repo
model_path = hf_hub_download(
repo_id="KnowlAI/parakeet-rnnt-0.6b-08122025-11.55",
filename="parakeet-knowl-hindi.nemo",
token=os.environ.get("HF_TOKEN")
)
asr_model = ASRModel.restore_from(model_path)
def transcribe_audio(audio):
"""Transcribe audio file"""
if audio is None:
return "Please upload or record an audio file."
try:
# Transcribe
transcription = asr_model.transcribe([audio])
return transcription[0]
except Exception as e:
return f"Error: {str(e)}"
def greet(name):
return "Hello " + name + "!!"
demo = gr.Interface(
fn=transcribe_audio,
inputs=gr.Audio(type="filepath", label="Upload or Record Audio"),
outputs=gr.Textbox(label="Transcription (Hindi)", lines=5),
title="Parakeet Hindi ASR Demo",
description="Upload or record Hindi speech to get the transcription. This model was trained for 100,000 steps on Hindi speech data."
)
#demo = gr.Interface(fn=greet, inputs="text", outputs="text")
demo.launch()
|