|
import gradio as gr |
|
import torch |
|
from transformers import pipeline, AutoTokenizer |
|
from nemo.collections.asr.models import EncDecMultiTaskModel |
|
|
|
|
|
canary_model = EncDecMultiTaskModel.from_pretrained('nvidia/canary-1b') |
|
|
|
|
|
decode_cfg = canary_model.cfg.decoding |
|
decode_cfg.beam.beam_size = 1 |
|
canary_model.change_decoding_strategy(decode_cfg) |
|
|
|
pipe = pipeline( |
|
"automatic-speech-recognition", |
|
model="nvidia/canary-1b" |
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gr.Interface.from_pipeline(pipe, |
|
title="ASR", |
|
description="Using pipeline with Canary-1B", |
|
).launch(inbrowser=True) |