Skip to content

Commit 8b581e0

Browse files
author
Daniel Lorch
committed
Reapply "chore: print inference_result using idp_common packages"
This reverts commit f3867f6.
1 parent 77aa5db commit 8b581e0

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

notebooks/misc/e2e-example-with-multimodal-page-classification-few-shot-prompting.ipynb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -364,20 +364,21 @@
364364
"metadata": {},
365365
"outputs": [],
366366
"source": [
367+
"from idp_common.s3 import get_json_content\n",
368+
"\n",
367369
"print(\"\\nShow extraction results...\\n\")\n",
368370
"\n",
369371
"document_dict = document.to_dict()\n",
370372
"sections_json = json.dumps(document_dict[\"sections\"][:n], indent=2)\n",
371-
"print(f\"{sections_json}...\")\n",
373+
"print(sections_json)\n",
372374
"\n",
373375
"for section in document.sections[:n]:\n",
374376
" print(f\"\\nSection {section.section_id} extraction result:\")\n",
375377
" extraction_result_uri = section.extraction_result_uri\n",
376-
" bucket, key = parse_s3_uri(extraction_result_uri)\n",
377-
" response = s3_client.get_object(Bucket=bucket, Key=key)\n",
378-
" content = response['Body'].read().decode('utf-8')\n",
379-
" result = json.loads(content)\n",
380-
" pprint.pp(result[\"inference_result\"])"
378+
" if extraction_result_uri:\n",
379+
" result = get_json_content(extraction_result_uri)\n",
380+
" result_json = json.dumps(result[\"inference_result\"], indent=2)\n",
381+
" print(result_json)"
381382
]
382383
},
383384
{

0 commit comments

Comments
 (0)