Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,6 +6,19 @@ from io import BytesIO
|
|
| 6 |
import re
|
| 7 |
import openai
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
def process_woocommerce_data_in_memory(netcom_file):
|
| 10 |
"""
|
| 11 |
Reads the uploaded NetCom CSV file in-memory, processes it to the WooCommerce format,
|
|
@@ -229,20 +242,6 @@ def process_woocommerce_data_in_memory(netcom_file):
|
|
| 229 |
]
|
| 230 |
woo_final_df = woo_final_df[column_order]
|
| 231 |
|
| 232 |
-
# 9. Convert to CSV (in memory)
|
| 233 |
-
output_buffer = BytesIO()
|
| 234 |
-
woo_final_df.to_csv(output_buffer, index=False, encoding='utf-8-sig')
|
| 235 |
-
output_buffer.seek(0)
|
| 236 |
-
|
| 237 |
-
return output_buffer
|
| 238 |
-
|
| 239 |
-
def process_woocommerce_data_in_memory(netcom_file):
|
| 240 |
-
"""
|
| 241 |
-
Reads the uploaded NetCom CSV file in-memory, processes it to the WooCommerce format,
|
| 242 |
-
and returns the resulting CSV as bytes, suitable for download.
|
| 243 |
-
"""
|
| 244 |
-
# [Keep all your existing processing code exactly the same until the end]
|
| 245 |
-
|
| 246 |
# 9. Convert to CSV (in memory)
|
| 247 |
output_buffer = BytesIO()
|
| 248 |
woo_final_df.to_csv(output_buffer, index=False, encoding='utf-8-sig')
|
|
|
|
| 6 |
import re
|
| 7 |
import openai
|
| 8 |
|
| 9 |
+
import gradio_client.utils
|
| 10 |
+
|
| 11 |
+
_original_json_schema_to_python_type = gradio_client.utils._json_schema_to_python_type
|
| 12 |
+
|
| 13 |
+
def _fixed_json_schema_to_python_type(schema, defs=None):
|
| 14 |
+
# If the schema is a bool, return a fallback type (e.g. "any")
|
| 15 |
+
if isinstance(schema, bool):
|
| 16 |
+
return "any"
|
| 17 |
+
return _original_json_schema_to_python_type(schema, defs)
|
| 18 |
+
|
| 19 |
+
gradio_client.utils._json_schema_to_python_type = _fixed_json_schema_to_python_type
|
| 20 |
+
|
| 21 |
+
|
| 22 |
def process_woocommerce_data_in_memory(netcom_file):
|
| 23 |
"""
|
| 24 |
Reads the uploaded NetCom CSV file in-memory, processes it to the WooCommerce format,
|
|
|
|
| 242 |
]
|
| 243 |
woo_final_df = woo_final_df[column_order]
|
| 244 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
# 9. Convert to CSV (in memory)
|
| 246 |
output_buffer = BytesIO()
|
| 247 |
woo_final_df.to_csv(output_buffer, index=False, encoding='utf-8-sig')
|