Spaces:
Runtime error
Runtime error
File size: 843 Bytes
b632993 |
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 |
import gradio as gr
from fbeeper_hubert import HubertBeeper
BEEPER = HubertBeeper()
def greet(audio):
global BEEPER
sample_rate, wav = audio
# Gradio loads sound files as ints, the model expects normalized floats
wav = wav / 32768
# TODO: output sample_rate doesn't have to match input sample rate
text, result_wav = BEEPER.f_beep_waveform(wav, sample_rate)
result_wav = (result_wav * 32768).astype("int16")
return (text, (sample_rate, result_wav))
if __name__ == '__main__':
iface = gr.Interface(
fn=greet,
inputs="audio",
outputs=[
gr.outputs.Textbox(label="ASR output"),
gr.outputs.Audio(label="Censored speech"),
],
examples=[["data/speech-short-16k.wav"], ["data/sample.wav"]],
server_port=7860,
)
iface.launch()
|