add EzAudio API
Browse files
app.py
CHANGED
@@ -176,7 +176,24 @@ def get_stable_audio_open(prompt):
|
|
176 |
except:
|
177 |
raise gr.Error("Stable Audio Open space API is not ready, please try again in few minutes ")
|
178 |
|
179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
180 |
|
181 |
def infer(image_in, chosen_model):
|
182 |
caption = get_caption(image_in)
|
@@ -198,6 +215,9 @@ def infer(image_in, chosen_model):
|
|
198 |
elif chosen_model == "Stable Audio Open" :
|
199 |
stable_audio_open_result = get_stable_audio_open(caption)
|
200 |
return stable_audio_open_result
|
|
|
|
|
|
|
201 |
|
202 |
css="""
|
203 |
#col-container{
|
@@ -220,7 +240,7 @@ with gr.Blocks(css=css) as demo:
|
|
220 |
with gr.Column():
|
221 |
image_in = gr.Image(sources=["upload"], type="filepath", label="Image input", value="oiseau.png")
|
222 |
with gr.Row():
|
223 |
-
chosen_model = gr.Dropdown(label="Choose a model", choices=["MAGNet", "AudioLDM-2", "AudioGen", "Tango", "Tango 2", "Stable Audio Open"], value="AudioLDM-2")
|
224 |
submit_btn = gr.Button("Submit")
|
225 |
with gr.Column():
|
226 |
audio_o = gr.Audio(label="Audio output")
|
|
|
176 |
except:
|
177 |
raise gr.Error("Stable Audio Open space API is not ready, please try again in few minutes ")
|
178 |
|
179 |
+
def get_ezaudio(prompt):
|
180 |
+
try:
|
181 |
+
client = Client("OpenSound/EzAudio")
|
182 |
+
result = client.predict(
|
183 |
+
text=prompt,
|
184 |
+
length=10,
|
185 |
+
guidance_scale=5,
|
186 |
+
guidance_rescale=0.75,
|
187 |
+
ddim_steps=50,
|
188 |
+
eta=1,
|
189 |
+
random_seed=0,
|
190 |
+
randomize_seed=True,
|
191 |
+
api_name="/generate_audio"
|
192 |
+
)
|
193 |
+
print(result)
|
194 |
+
return result
|
195 |
+
except:
|
196 |
+
raise gr.Error("EzAudio space API is not ready, please try again in few minutes ")
|
197 |
|
198 |
def infer(image_in, chosen_model):
|
199 |
caption = get_caption(image_in)
|
|
|
215 |
elif chosen_model == "Stable Audio Open" :
|
216 |
stable_audio_open_result = get_stable_audio_open(caption)
|
217 |
return stable_audio_open_result
|
218 |
+
elif chosen_model == "EzAudio" :
|
219 |
+
ezaudio_result = get_ezaudio(caption)
|
220 |
+
return ezaudio_result
|
221 |
|
222 |
css="""
|
223 |
#col-container{
|
|
|
240 |
with gr.Column():
|
241 |
image_in = gr.Image(sources=["upload"], type="filepath", label="Image input", value="oiseau.png")
|
242 |
with gr.Row():
|
243 |
+
chosen_model = gr.Dropdown(label="Choose a model", choices=["MAGNet", "AudioLDM-2", "AudioGen", "Tango", "Tango 2", "Stable Audio Open", "EzAudio"], value="AudioLDM-2")
|
244 |
submit_btn = gr.Button("Submit")
|
245 |
with gr.Column():
|
246 |
audio_o = gr.Audio(label="Audio output")
|