Manjushri commited on
Commit
9162caa
1 Parent(s): 95a4575

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torchaudio
2
+ from audiocraft.models import AudioGen
3
+ from audiocraft.data.audio import audio_write
4
+ import gradio as gr
5
+
6
+ model = AudioGen.get_pretrained('facebook/audiogen-medium')
7
+ model.set_generation_params(duration=8) # generate 8 seconds.
8
+ wav = model.generate_unconditional(1) # generates 4 unconditional audio samples
9
+
10
+ def AudioGenie(Prompt):
11
+ descriptions = [Prompt]
12
+ wav = model.generate(descriptions) # generates 3 samples.
13
+ for idx, one_wav in enumerate(wav):…
14
+ return wav
15
+
16
+ gr.Interface(fn=AudioGenie, inputs= 'text', outputs= 'audio').launch(debug=True)