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()