Spaces:
Runtime error
Runtime error
File size: 679 Bytes
d03259c 92e7451 d03259c 92e7451 0ced63d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
from transformers import pipeline
import gradio as gr
import numpy as np
pipe = pipeline(model="openai/whisper-tiny")
def asr(test_file):
return pipe(test_file, max_new_tokens=100)
def gradio_asr(test_file):
return asr(test_file)
asr_upload = gr.Interface(fn=gradio_asr,
inputs=gr.Audio(source='upload', type='filepath'),
outputs='text')
app_mic = gr.Interface(fn=gradio_asr,
inputs=gr.Audio(source='microphone', type='filepath'),
outputs='text')
app = gr.TabbedInterface([asr_upload, app_mic], ["语音文件", "实时识别"])
app.launch(server_name='0.0.0.0', ssl_verify=False) |