Spaces:
Build error
Build error
File size: 900 Bytes
66dcbda 012976e 66dcbda 012976e 66dcbda 012976e d07be14 012976e c5ee48a 012976e |
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 |
import gradio
import numpy as np
import torch
from hifi_gan_bwe import BandwidthExtender
model = BandwidthExtender.from_pretrained("hifi-gan-bwe-05-d3abf04-vctk-48kHz")
def extend(audio):
fs, x = audio
x = x.astype(np.float32) / 32767.0
with torch.no_grad():
y = np.stack([model(torch.from_numpy(x), fs) for x in x.T]).T
y = (y * 32767.0).astype(np.int16)
fs = int(model.sample_rate)
return fs, y
gradio.Interface(
fn=extend,
examples=[["examples/example.wav"]],
title="HiFi-GAN+",
description="""
An audio bandwidth extension model from the paper
[Bandwidth Extension is All You Need](https://doi.org/10.1109/ICASSP39728.2021.9413575)
by Su, et al.
For more information, see this
[blog post](https://brentspell.com/2022/hifi-gan-bwe).
""",
thumbnail="https://brentspell.com/favicon-32x32.png",
inputs="audio",
outputs="audio",
).launch()
|