latuan commited on
Commit
6e55cc1
1 Parent(s): ad98956
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -2,7 +2,7 @@ import os
2
  import re
3
  import io
4
  import torch
5
- import shutil
6
  import requests
7
  import torchaudio
8
  import numpy as np
@@ -218,7 +218,7 @@ def download_all(outputs):
218
  raise gr.Warning("No files available for download.")
219
 
220
  zip_path = os.path.join(cache_dir, "all_outputs.zip")
221
- with shutil.ZipFile(zip_path, 'w') as zipf:
222
  for file_path in outputs:
223
  zipf.write(file_path, os.path.basename(file_path))
224
  return zip_path
@@ -253,13 +253,19 @@ with gr.Blocks(css=css) as demo:
253
  file_count="multiple",
254
  type="filepath",
255
  height=600,
 
256
  )
257
 
258
  btn = gr.Button("Generate")
259
  download_btn = gr.Button("Download All")
 
 
 
 
 
260
 
261
  btn.click(fn=srt_to_audio_multi, inputs=inp, outputs=out)
262
- download_btn.click(fn=download_all, inputs=out, outputs=gr.File(label="Download ZIP"))
263
 
264
  if __name__ == "__main__":
265
  demo.launch()
 
2
  import re
3
  import io
4
  import torch
5
+ import zipfile
6
  import requests
7
  import torchaudio
8
  import numpy as np
 
218
  raise gr.Warning("No files available for download.")
219
 
220
  zip_path = os.path.join(cache_dir, "all_outputs.zip")
221
+ with zipfile.ZipFile(zip_path, 'w') as zipf:
222
  for file_path in outputs:
223
  zipf.write(file_path, os.path.basename(file_path))
224
  return zip_path
 
253
  file_count="multiple",
254
  type="filepath",
255
  height=600,
256
+ interactive=False
257
  )
258
 
259
  btn = gr.Button("Generate")
260
  download_btn = gr.Button("Download All")
261
+ download_out = gr.File(
262
+ label="Download ZIP",
263
+ interactive=False,
264
+ height=100
265
+ )
266
 
267
  btn.click(fn=srt_to_audio_multi, inputs=inp, outputs=out)
268
+ download_btn.click(fn=download_all, inputs=out, outputs=download_out)
269
 
270
  if __name__ == "__main__":
271
  demo.launch()