dunlp commited on
Commit
bbc169d
·
verified ·
1 Parent(s): e7f75f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
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 a dictionary with 'name' and 'data'
71
- return {'name': 'output.zip', 'data': output_zip_buffer.getvalue()}, None
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.Code(label="Error Log", language="python")
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."