Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -60,7 +60,7 @@ with gr.Blocks(css=css) as demo:
|
|
60 |
run_button = gr.Button("Convert", scale=0)
|
61 |
result = gr.Gallery(label="Result")
|
62 |
download_button = gr.Button("Download All as ZIP")
|
63 |
-
|
64 |
converted_files = []
|
65 |
|
66 |
def handle_conversion(avif_files):
|
@@ -70,8 +70,9 @@ with gr.Blocks(css=css) as demo:
|
|
70 |
|
71 |
def handle_download():
|
72 |
if not converted_files:
|
73 |
-
|
74 |
-
|
|
|
75 |
|
76 |
run_button.click(
|
77 |
fn=handle_conversion,
|
@@ -81,6 +82,6 @@ with gr.Blocks(css=css) as demo:
|
|
81 |
download_button.click(
|
82 |
fn=handle_download,
|
83 |
inputs=[],
|
84 |
-
outputs=[gr.File()
|
85 |
)
|
86 |
demo.queue().launch()
|
|
|
60 |
run_button = gr.Button("Convert", scale=0)
|
61 |
result = gr.Gallery(label="Result")
|
62 |
download_button = gr.Button("Download All as ZIP")
|
63 |
+
error_modal = gr.Modal("No files to download. Please upload and convert AVIF files first.")
|
64 |
converted_files = []
|
65 |
|
66 |
def handle_conversion(avif_files):
|
|
|
70 |
|
71 |
def handle_download():
|
72 |
if not converted_files:
|
73 |
+
error_modal.show()
|
74 |
+
return None
|
75 |
+
return zip_files(converted_files)
|
76 |
|
77 |
run_button.click(
|
78 |
fn=handle_conversion,
|
|
|
82 |
download_button.click(
|
83 |
fn=handle_download,
|
84 |
inputs=[],
|
85 |
+
outputs=[gr.File()]
|
86 |
)
|
87 |
demo.queue().launch()
|