Spaces:
Runtime error
Runtime error
File size: 697 Bytes
3f4845d 8e4bd44 405ca2c 8e4bd44 405ca2c 8e4bd44 3f4845d 8e4bd44 405ca2c 8e4bd44 3f4845d 8e4bd44 3f4845d 8e4bd44 3f4845d 8e4bd44 |
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 |
import gradio as gr
import torchaudio
from audiocraft.models import MAGNeT
from audiocraft. data. audio import audio_write
model = MAGNeT.get_pretrained('facebook/magnet-small-10secs')
def infer(description):
descriptions = ['disco beat', 'energetic EDM']
wav = model.generate(descriptions)
for idx, one_wav in enumerate(wav):
print(idx)
audio_write(f'{idx}',
one_wav.cpu(),
model.sample_rate,
strategy="loudness",
loudness_compressor=True)
return "done"
gr.Interface(
fn = infer,
inputs = gr.Textbox(value="gogo"),
outputs = gr.Textbox()
).launch() |