Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -127,14 +127,14 @@ def extract_invoice_data(file_data, content_type, json_schema):
|
|
| 127 |
|
| 128 |
try:
|
| 129 |
parsed_content = json.loads(cleaned_content)
|
| 130 |
-
return parsed_content
|
| 131 |
except json.JSONDecodeError as e:
|
| 132 |
logger.error(f"JSON Parse Error: {e}")
|
| 133 |
-
return None
|
| 134 |
|
| 135 |
except Exception as e:
|
| 136 |
logger.error(f"Error in data extraction: {e}")
|
| 137 |
-
return {"error": str(e)}
|
| 138 |
|
| 139 |
def get_content_type_from_s3(file_key):
|
| 140 |
"""Fetch the content type (MIME type) of a file stored in S3."""
|
|
|
|
| 127 |
|
| 128 |
try:
|
| 129 |
parsed_content = json.loads(cleaned_content)
|
| 130 |
+
return parsed_content,base64dataresp
|
| 131 |
except json.JSONDecodeError as e:
|
| 132 |
logger.error(f"JSON Parse Error: {e}")
|
| 133 |
+
return None,base64dataresp
|
| 134 |
|
| 135 |
except Exception as e:
|
| 136 |
logger.error(f"Error in data extraction: {e}")
|
| 137 |
+
return {"error": str(e)},base64dataresp
|
| 138 |
|
| 139 |
def get_content_type_from_s3(file_key):
|
| 140 |
"""Fetch the content type (MIME type) of a file stored in S3."""
|