Skip to content

Commit 4071d2c

Browse files
author
Daniel Lorch
committed
chore: print inference_result using idp_common packages
1 parent 9a37c9b commit 4071d2c

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
@@ -390,20 +390,21 @@
390390
"metadata": {},
391391
"outputs": [],
392392
"source": [
393+
"from idp_common.s3 import get_json_content\n",
394+
"\n",
393395
"print(\"\\nShow extraction results...\\n\")\n",
394396
"\n",
395397
"document_dict = document.to_dict()\n",
396398
"sections_json = json.dumps(document_dict[\"sections\"][:n], indent=2)\n",
397-
"print(f\"{sections_json}...\")\n",
399+
"print(sections_json)\n",
398400
"\n",
399401
"for section in document.sections[:n]:\n",
400402
" print(f\"\\nSection {section.section_id} extraction result:\")\n",
401403
" extraction_result_uri = section.extraction_result_uri\n",
402-
" bucket, key = parse_s3_uri(extraction_result_uri)\n",
403-
" response = s3_client.get_object(Bucket=bucket, Key=key)\n",
404-
" content = response['Body'].read().decode('utf-8')\n",
405-
" result = json.loads(content)\n",
406-
" pprint.pp(result[\"inference_result\"])"
404+
" if extraction_result_uri:\n",
405+
" result = get_json_content(extraction_result_uri)\n",
406+
" result_json = json.dumps(result[\"inference_result\"], indent=2)\n",
407+
" print(result_json)"
407408
]
408409
},
409410
{

0 commit comments

Comments
 (0)