npc0 commited on
Commit
1568641
·
verified ·
1 Parent(s): 9ea67e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -49,12 +49,14 @@ def check_password():
49
  if not check_password():
50
  st.stop() # Do not continue if check_password is not True.
51
 
52
- def generate_zip(files):
53
  """Generates a zip file containing the input files."""
54
  zip_buffer = io.BytesIO()
55
  with zipfile.ZipFile(zip_buffer, 'w') as zip_file:
56
- for filename, file_content in files.items():
57
- zip_file.writestr(filename, file_content)
 
 
58
  zip_buffer.seek(0)
59
  return zip_buffer
60
 
 
49
  if not check_password():
50
  st.stop() # Do not continue if check_password is not True.
51
 
52
+ def generate_zip(filenames: list):
53
  """Generates a zip file containing the input files."""
54
  zip_buffer = io.BytesIO()
55
  with zipfile.ZipFile(zip_buffer, 'w') as zip_file:
56
+ for filename in filenames:
57
+ with open(filename, 'rb') as f:
58
+ file_content = f.read()
59
+ zip_file.writestr(filename, file_content)
60
  zip_buffer.seek(0)
61
  return zip_buffer
62