Update app.py
Browse files
app.py
CHANGED
|
@@ -66,9 +66,11 @@ def process_files(phase, objecten_file_data, templates_zip_file_data):
|
|
| 66 |
|
| 67 |
file_path = folder_path + adjusted_filename
|
| 68 |
zf.writestr(file_path, file_content)
|
|
|
|
|
|
|
| 69 |
output_zip_buffer.seek(0)
|
| 70 |
-
# Return
|
| 71 |
-
|
| 72 |
except Exception as e:
|
| 73 |
# Capture the full traceback
|
| 74 |
error_msg = traceback.format_exc()
|
|
@@ -84,8 +86,8 @@ interface = gr.Interface(
|
|
| 84 |
gr.File(label="Upload Templates ZIP File", type='binary')
|
| 85 |
],
|
| 86 |
outputs=[
|
| 87 |
-
gr.File(label="Download ZIP File"),
|
| 88 |
-
gr.
|
| 89 |
],
|
| 90 |
title="Template Folder Generator",
|
| 91 |
description="Upload 'objecten.txt' and a ZIP file containing template files to generate folders and files."
|
|
|
|
| 66 |
|
| 67 |
file_path = folder_path + adjusted_filename
|
| 68 |
zf.writestr(file_path, file_content)
|
| 69 |
+
|
| 70 |
+
# Finalize the output
|
| 71 |
output_zip_buffer.seek(0)
|
| 72 |
+
return (output_zip_buffer, "output.zip"), "" # Return file and an empty error log on success
|
| 73 |
+
|
| 74 |
except Exception as e:
|
| 75 |
# Capture the full traceback
|
| 76 |
error_msg = traceback.format_exc()
|
|
|
|
| 86 |
gr.File(label="Upload Templates ZIP File", type='binary')
|
| 87 |
],
|
| 88 |
outputs=[
|
| 89 |
+
gr.File(label="Download ZIP File"), # This expects a tuple (file data, filename)
|
| 90 |
+
gr.Textbox(label="Error Log") # Textbox to display the error log
|
| 91 |
],
|
| 92 |
title="Template Folder Generator",
|
| 93 |
description="Upload 'objecten.txt' and a ZIP file containing template files to generate folders and files."
|