debug: log file sizes at extraction and processing stages
Add logging to compare file sizes: - [EXTRACT] sent to Gemini - [CREATE_ITEM] received when creating item This will reveal if image is being processed/changed between extraction and local processing.
This commit is contained in:
@@ -103,7 +103,9 @@ async def extract_label(
|
|||||||
detail="File exceeds 10MB limit."
|
detail="File exceeds 10MB limit."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
log.info(f"[EXTRACT] Sending {len(contents)} bytes to Gemini for analysis")
|
||||||
result = extract_label_info(contents, mode=mode)
|
result = extract_label_info(contents, mode=mode)
|
||||||
|
log.info(f"[EXTRACT] Gemini returned: {type(result).__name__}")
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@router.post("/", response_model=schemas.Item, status_code=status.HTTP_201_CREATED)
|
@router.post("/", response_model=schemas.Item, status_code=status.HTTP_201_CREATED)
|
||||||
@@ -152,6 +154,7 @@ def create_item(
|
|||||||
try:
|
try:
|
||||||
import base64
|
import base64
|
||||||
image_bytes = base64.b64decode(item.extracted_image_bytes)
|
image_bytes = base64.b64decode(item.extracted_image_bytes)
|
||||||
|
log.info(f"[CREATE_ITEM] Received {len(image_bytes)} bytes for photo processing (base64 decoded)")
|
||||||
|
|
||||||
photo_result = _auto_save_photo_from_extraction(
|
photo_result = _auto_save_photo_from_extraction(
|
||||||
item_id=db_item.id,
|
item_id=db_item.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user