joycecast commited on
Commit
86c1501
·
verified ·
1 Parent(s): a1a3df8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -7,7 +7,7 @@ import tempfile
7
 
8
  # Define transformation function
9
 
10
- def convert_ci(by_line_item_file, combined_file, password):
11
  # Decrypt the protected "by line item" file
12
  decrypted = io.BytesIO()
13
  with open(by_line_item_file.name, "rb") as f:
@@ -143,8 +143,7 @@ def convert_ci(by_line_item_file, combined_file, password):
143
  merged_df[col] = ""
144
  merged_df = merged_df[column_order]
145
 
146
- # Save merged output partitioned into 351-row chunks
147
- max_rows = 350
148
  outputs = []
149
 
150
  for i, start in enumerate(range(0, len(merged_df), max_rows)):
@@ -170,7 +169,8 @@ iface = gr.Interface(
170
  inputs=[
171
  gr.File(label="Upload 'By Line Item' File (.xlsx)", type="filepath"),
172
  gr.File(label="Upload 'Combined' File (.xlsx)", type="filepath"),
173
- gr.Textbox(label="Password for 'By Line Item' File", type="password")
 
174
  ],
175
  outputs=gr.File(label="Download Partitioned Files", file_types=[".xlsx"], file_count="multiple"),
176
  title="SHEIN CI to Magaya Format Conversion Tool",
 
7
 
8
  # Define transformation function
9
 
10
+ def convert_ci(by_line_item_file, combined_file, password, max_rows):
11
  # Decrypt the protected "by line item" file
12
  decrypted = io.BytesIO()
13
  with open(by_line_item_file.name, "rb") as f:
 
143
  merged_df[col] = ""
144
  merged_df = merged_df[column_order]
145
 
146
+ # Save merged output partitioned into 998-row chunks
 
147
  outputs = []
148
 
149
  for i, start in enumerate(range(0, len(merged_df), max_rows)):
 
169
  inputs=[
170
  gr.File(label="Upload 'By Line Item' File (.xlsx)", type="filepath"),
171
  gr.File(label="Upload 'Combined' File (.xlsx)", type="filepath"),
172
+ gr.Textbox(label="Password for 'By Line Item' File", type="password"),
173
+ gr.Number(label="Max Rows per Output File", value=350, precision=0)
174
  ],
175
  outputs=gr.File(label="Download Partitioned Files", file_types=[".xlsx"], file_count="multiple"),
176
  title="SHEIN CI to Magaya Format Conversion Tool",