Spaces:
Build error
Build error
Update app.py
Browse files
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(
|
| 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
|
| 57 |
-
|
|
|
|
|
|
|
| 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 |
|