Spaces:
Build error
Build error
File size: 868 Bytes
5b5d4af 11f7102 5b5d4af c78ff8f 5b5d4af c78ff8f 5b5d4af c78ff8f 5b5d4af c78ff8f 5b5d4af |
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 32 33 34 35 36 37 38 39 40 41 42 43 44 |
import os
import numpy as np
import gradio as gr
import whisper
model = whisper.load_model("base.en")
def fun(audio, state=''):
text = model.transcribe(audio)["text"]
state += text + " "
return state, state
def transcribe(audio, state=""):
text = p(audio)["text"]
state += text + " "
return state, state
# Set the starting state to an empty string
#gr.Interface(
# fn=transcribe,
# inputs=[
# gr.Audio(source="microphone", type="filepath", streaming=True),
# "state"
# ],
# outputs=[
# "textbox",
# "state"
# ],
# live=True).launch()
gr.Interface(
title = 'Testing Whisper',
fn=fun,
inputs=[
gr.inputs.Audio(source="microphone", streaming = True, type="filepath"),
"state"
],
outputs=[
"textbox", "state"
],
live=True).launch()
|