AudioGen / app.py
Manjushri's picture
Create app.py
9162caa
raw
history blame
586 Bytes
import torchaudio
from audiocraft.models import AudioGen
from audiocraft.data.audio import audio_write
import gradio as gr
model = AudioGen.get_pretrained('facebook/audiogen-medium')
model.set_generation_params(duration=8) # generate 8 seconds.
wav = model.generate_unconditional(1) # generates 4 unconditional audio samples
def AudioGenie(Prompt):
descriptions = [Prompt]
wav = model.generate(descriptions) # generates 3 samples.
for idx, one_wav in enumerate(wav):…
return wav
gr.Interface(fn=AudioGenie, inputs= 'text', outputs= 'audio').launch(debug=True)