File size: 592 Bytes
0eb9cd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from transformers import pipeline
import gradio as gr

transcribe = pipeline(
    task="automatic-speech-recognition",
    model="ckpt_large_v2/checkpoint-1740",
    tokenizer="ckpt_large_v2",
    chunk_length_s=30,
    device=-1,
)

transcribe.model.config.forced_decoder_ids = transcribe.tokenizer.get_decoder_prompt_ids(language="ja", task="transcribe")
def main(audio_path):
    return transcribe(audio_path)["text"]



iface = gr.Interface(
  fn=main,
  inputs=gr.inputs.Audio(type='filepath'),
  outputs="text",
  title="Whisper-base finetuned on Coco-Nut Corpus",
).launch(share=True)