Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -359,7 +359,6 @@ Output JSON:
|
|
| 359 |
"""
|
| 360 |
response = model.generate_content(prompt)
|
| 361 |
llm_output = response.text
|
| 362 |
-
logger.info(f"Raw Gemini response: {llm_output}")
|
| 363 |
|
| 364 |
json_start = llm_output.find("{")
|
| 365 |
json_end = llm_output.rfind("}") + 1
|
|
@@ -368,7 +367,6 @@ Output JSON:
|
|
| 368 |
logger.info(f"Extracted JSON before fix: {json_str}")
|
| 369 |
|
| 370 |
json_str = fix_scientific_notation_in_json(json_str)
|
| 371 |
-
logger.info(f"Fixed JSON string: {json_str}")
|
| 372 |
|
| 373 |
structured_data = json.loads(json_str, parse_float=custom_decimal_parser)
|
| 374 |
structured_data = convert_scientific_decimals(structured_data)
|
|
@@ -379,7 +377,6 @@ Output JSON:
|
|
| 379 |
|
| 380 |
# Log structured data with custom encoder to avoid scientific notation in logs
|
| 381 |
log_friendly_data = json.dumps(structured_data, default=custom_encoder)
|
| 382 |
-
logger.info(f"Final Structured Data (JSON format): {log_friendly_data}")
|
| 383 |
|
| 384 |
return structured_data
|
| 385 |
except Exception as e:
|
|
|
|
| 359 |
"""
|
| 360 |
response = model.generate_content(prompt)
|
| 361 |
llm_output = response.text
|
|
|
|
| 362 |
|
| 363 |
json_start = llm_output.find("{")
|
| 364 |
json_end = llm_output.rfind("}") + 1
|
|
|
|
| 367 |
logger.info(f"Extracted JSON before fix: {json_str}")
|
| 368 |
|
| 369 |
json_str = fix_scientific_notation_in_json(json_str)
|
|
|
|
| 370 |
|
| 371 |
structured_data = json.loads(json_str, parse_float=custom_decimal_parser)
|
| 372 |
structured_data = convert_scientific_decimals(structured_data)
|
|
|
|
| 377 |
|
| 378 |
# Log structured data with custom encoder to avoid scientific notation in logs
|
| 379 |
log_friendly_data = json.dumps(structured_data, default=custom_encoder)
|
|
|
|
| 380 |
|
| 381 |
return structured_data
|
| 382 |
except Exception as e:
|