File size: 782 Bytes
0eb9cd6
 
b684373
0eb9cd6
 
 
a5d71b1
 
0eb9cd6
a9075b6
0eb9cd6
 
0871d92
b684373
0eb9cd6
 
 
 
ddb5be9
 
 
 
0eb9cd6
 
 
ddb5be9
 
0eb9cd6
ddb5be9
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
25
26
27
28
29
30
31
from transformers import pipeline
import gradio as gr
import spaces

transcribe = pipeline(
    task="automatic-speech-recognition",
    model="ckpt_base/checkpoint-1308",
    tokenizer="ckpt_base",
    chunk_length_s=30,
    device=0,
)
transcribe.model.config.forced_decoder_ids = transcribe.tokenizer.get_decoder_prompt_ids(language="ja", task="transcribe")

@spaces.GPU
def main(audio_path):
    return transcribe(audio_path)["text"]


with open('./README.md') as f:
    md = f.readlines()
    md = md[11:]
    md = "\n".join(md)

iface = gr.Interface(
  fn=main,
  inputs=[gr.Audio(type='filepath',sources=['microphone','upload'])],
  description=md,
  outputs="text",
  title="CoCoCap-beta 日本語声質キャプショニンング with CocoNut Corpus",
).launch(share=True)