Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -77,7 +77,7 @@ def submit_job(audio_file, preset, beat_sensitivity, fps, width, height):
|
|
77 |
else:
|
78 |
output_url = tracking_data['links']['outputUrls'][0]
|
79 |
logging.info(f"Job succeeded. Output URL: {output_url}")
|
80 |
-
return output_url
|
81 |
|
82 |
description1 = """
|
83 |
# Audio Visualizer Playground
|
@@ -167,8 +167,10 @@ video, .gr-video {
|
|
167 |
"""
|
168 |
|
169 |
def main(audio_file, preset, beat_sensitivity, fps, width, height):
|
170 |
-
|
171 |
-
|
|
|
|
|
172 |
|
173 |
with gr.Blocks(css=custom_css) as demo:
|
174 |
gr.Markdown(description1, elem_id="markdown-text")
|
@@ -187,11 +189,17 @@ with gr.Blocks(css=custom_css) as demo:
|
|
187 |
height = gr.Slider(label="Height", minimum=512, maximum=1024, step=1, value=512)
|
188 |
submit_button = gr.Button("Submit")
|
189 |
output_video = gr.Video(label="Output MP4")
|
|
|
190 |
|
191 |
-
def update_output(video_url):
|
192 |
-
|
|
|
|
|
|
|
|
|
|
|
193 |
|
194 |
-
submit_button.click(main, inputs=[audio_file, preset, beat_sensitivity, fps, width, height], outputs=[output_video])
|
195 |
|
196 |
if __name__ == "__main__":
|
197 |
demo.launch()
|
|
|
77 |
else:
|
78 |
output_url = tracking_data['links']['outputUrls'][0]
|
79 |
logging.info(f"Job succeeded. Output URL: {output_url}")
|
80 |
+
return output_url, None
|
81 |
|
82 |
description1 = """
|
83 |
# Audio Visualizer Playground
|
|
|
167 |
"""
|
168 |
|
169 |
def main(audio_file, preset, beat_sensitivity, fps, width, height):
|
170 |
+
result, error = submit_job(audio_file, preset, beat_sensitivity, fps, width, height)
|
171 |
+
if error:
|
172 |
+
return None, error
|
173 |
+
return result, None
|
174 |
|
175 |
with gr.Blocks(css=custom_css) as demo:
|
176 |
gr.Markdown(description1, elem_id="markdown-text")
|
|
|
189 |
height = gr.Slider(label="Height", minimum=512, maximum=1024, step=1, value=512)
|
190 |
submit_button = gr.Button("Submit")
|
191 |
output_video = gr.Video(label="Output MP4")
|
192 |
+
output_error = gr.Textbox(label="Error", visible=False)
|
193 |
|
194 |
+
def update_output(video_url, error):
|
195 |
+
if error:
|
196 |
+
output_error.update(value=error, visible=True)
|
197 |
+
output_video.update(value=None, visible=False)
|
198 |
+
else:
|
199 |
+
output_error.update(value="", visible=False)
|
200 |
+
output_video.update(value=video_url, visible=True)
|
201 |
|
202 |
+
submit_button.click(main, inputs=[audio_file, preset, beat_sensitivity, fps, width, height], outputs=[output_video, output_error])
|
203 |
|
204 |
if __name__ == "__main__":
|
205 |
demo.launch()
|