Add Satable Audio Open option
Browse files
app.py
CHANGED
@@ -150,6 +150,22 @@ def get_tango2(prompt):
|
|
150 |
)
|
151 |
print(result)
|
152 |
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
|
154 |
def infer(image_in, chosen_model):
|
155 |
caption = get_caption(image_in)
|
@@ -168,6 +184,9 @@ def infer(image_in, chosen_model):
|
|
168 |
elif chosen_model == "Tango 2" :
|
169 |
tango2_result = get_tango2(caption)
|
170 |
return tango2_result
|
|
|
|
|
|
|
171 |
|
172 |
css="""
|
173 |
#col-container{
|
@@ -190,7 +209,7 @@ with gr.Blocks(css=css) as demo:
|
|
190 |
with gr.Column():
|
191 |
image_in = gr.Image(sources=["upload"], type="filepath", label="Image input", value="oiseau.png")
|
192 |
with gr.Row():
|
193 |
-
chosen_model = gr.Dropdown(label="Choose a model", choices=["MAGNet", "AudioLDM-2", "AudioGen", "Tango", "Tango 2"], value="AudioLDM-2")
|
194 |
submit_btn = gr.Button("Submit")
|
195 |
with gr.Column():
|
196 |
audio_o = gr.Audio(label="Audio output")
|
|
|
150 |
)
|
151 |
print(result)
|
152 |
return result
|
153 |
+
|
154 |
+
def get_stable_audio_open(prompt):
|
155 |
+
try:
|
156 |
+
client = Client("artificialguybr/Stable-Audio-Open-Zero")
|
157 |
+
except:
|
158 |
+
raise gr.Error("Stable Audio Open space API is not ready, please try again in few minutes ")
|
159 |
+
|
160 |
+
result = client.predict(
|
161 |
+
prompt=prompt,
|
162 |
+
seconds_total=30,
|
163 |
+
steps=100,
|
164 |
+
cfg_scale=7,
|
165 |
+
api_name="/predict"
|
166 |
+
)
|
167 |
+
print(result)
|
168 |
+
return result
|
169 |
|
170 |
def infer(image_in, chosen_model):
|
171 |
caption = get_caption(image_in)
|
|
|
184 |
elif chosen_model == "Tango 2" :
|
185 |
tango2_result = get_tango2(caption)
|
186 |
return tango2_result
|
187 |
+
elif chosen_model == "Stable Audio Open" :
|
188 |
+
stable_audio_open_result = get_stable_audio_open(caption)
|
189 |
+
return stable_audio_open_result
|
190 |
|
191 |
css="""
|
192 |
#col-container{
|
|
|
209 |
with gr.Column():
|
210 |
image_in = gr.Image(sources=["upload"], type="filepath", label="Image input", value="oiseau.png")
|
211 |
with gr.Row():
|
212 |
+
chosen_model = gr.Dropdown(label="Choose a model", choices=["MAGNet", "AudioLDM-2", "AudioGen", "Tango", "Tango 2", "Stable Audio Open"], value="AudioLDM-2")
|
213 |
submit_btn = gr.Button("Submit")
|
214 |
with gr.Column():
|
215 |
audio_o = gr.Audio(label="Audio output")
|