Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -203,18 +203,21 @@ def blend_vsfx(video_in, audio_result):
|
|
203 |
def infer(video_in, chosen_model):
|
204 |
image_in = extract_firstframe(video_in)
|
205 |
caption = get_caption(image_in)
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
|
|
|
|
|
|
218 |
|
219 |
final_res = blend_vsfx(video_in, audio_result)
|
220 |
return gr.update(value=caption, interactive=True), gr.update(interactive=True), audio_result, final_res
|
@@ -222,19 +225,21 @@ def infer(video_in, chosen_model):
|
|
222 |
def retry(edited_prompt, video_in, chosen_model):
|
223 |
image_in = extract_firstframe(video_in)
|
224 |
caption = edited_prompt
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
|
|
|
|
238 |
final_res = blend_vsfx(video_in, audio_result)
|
239 |
return audio_result, final_res
|
240 |
|
|
|
203 |
def infer(video_in, chosen_model):
|
204 |
image_in = extract_firstframe(video_in)
|
205 |
caption = get_caption(image_in)
|
206 |
+
try:
|
207 |
+
if chosen_model == "MAGNet" :
|
208 |
+
audio_result = get_magnet(caption)
|
209 |
+
elif chosen_model == "AudioLDM-2" :
|
210 |
+
audio_result = get_audioldm(caption)
|
211 |
+
elif chosen_model == "AudioGen" :
|
212 |
+
audio_result = get_audiogen(caption)
|
213 |
+
elif chosen_model == "Tango" :
|
214 |
+
audio_result = get_tango(caption)
|
215 |
+
elif chosen_model == "Tango 2" :
|
216 |
+
audio_result = get_tango2(caption)
|
217 |
+
elif chosen_model == "Stable Audio Open" :
|
218 |
+
audio_result = get_stable_audio_open(caption)
|
219 |
+
except:
|
220 |
+
raise gr.Error(f"an error occured with {chosen_model}")
|
221 |
|
222 |
final_res = blend_vsfx(video_in, audio_result)
|
223 |
return gr.update(value=caption, interactive=True), gr.update(interactive=True), audio_result, final_res
|
|
|
225 |
def retry(edited_prompt, video_in, chosen_model):
|
226 |
image_in = extract_firstframe(video_in)
|
227 |
caption = edited_prompt
|
228 |
+
try:
|
229 |
+
if chosen_model == "MAGNet" :
|
230 |
+
audio_result = get_magnet(caption)
|
231 |
+
elif chosen_model == "AudioLDM-2" :
|
232 |
+
audio_result = get_audioldm(caption)
|
233 |
+
elif chosen_model == "AudioGen" :
|
234 |
+
audio_result = get_audiogen(caption)
|
235 |
+
elif chosen_model == "Tango" :
|
236 |
+
audio_result = get_tango(caption)
|
237 |
+
elif chosen_model == "Tango 2" :
|
238 |
+
audio_result = get_tango2(caption)
|
239 |
+
elif chosen_model == "Stable Audio Open" :
|
240 |
+
audio_result = get_stable_audio_open(caption)
|
241 |
+
except:
|
242 |
+
raise gr.Error(f"an error occured with {chosen_model}")
|
243 |
final_res = blend_vsfx(video_in, audio_result)
|
244 |
return audio_result, final_res
|
245 |
|