ID0M commited on
Commit
f696b8f
·
verified ·
1 Parent(s): 2597f27

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -9
app.py CHANGED
@@ -31,7 +31,10 @@ def convert_avif_to_png(avif_files):
31
 
32
 
33
  def zip_files(file_paths):
34
- zip_path = "/tmp/converted_avif.zip"
 
 
 
35
  with zipfile.ZipFile(zip_path, 'w') as zipf:
36
  for file_path in file_paths:
37
  if os.path.isfile(file_path):
@@ -80,13 +83,5 @@ with gr.Blocks(css=css) as demo:
80
  fn=handle_download,
81
  inputs=[],
82
  outputs=[gr.File()]
83
- ).success(
84
- lambda: gr.Info("Download started."),
85
- inputs=None,
86
- outputs=None
87
- ).error(
88
- lambda e: gr.Error(str(e)),
89
- inputs=None,
90
- outputs=None
91
  )
92
  demo.queue().launch()
 
31
 
32
 
33
  def zip_files(file_paths):
34
+ if not file_paths:
35
+ gr.Error("No files to download. Please upload and convert AVIF files first.")
36
+ return
37
+ zip_path = "/tmp/converted_images.zip"
38
  with zipfile.ZipFile(zip_path, 'w') as zipf:
39
  for file_path in file_paths:
40
  if os.path.isfile(file_path):
 
83
  fn=handle_download,
84
  inputs=[],
85
  outputs=[gr.File()]
 
 
 
 
 
 
 
 
86
  )
87
  demo.queue().launch()