Skip to content

Commit

Permalink
better count output
Browse files Browse the repository at this point in the history
  • Loading branch information
haesleinhuepf committed Aug 4, 2023
1 parent d66b31d commit 533a689
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions docs/07_prompt_engineering/30_langchain_bia.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,13 @@
"outputs": [],
"source": [
"def count_objects(image_name):\n",
" print(\"counting labels in \", image_name)\n",
" \n",
" label_image = image_storage[image_name]\n",
" \n",
" num_labels = label_image.max()\n",
" return f\"The labe image {image_name} contains {num_labels} labels.\"\n",
" print(\"counting labels in \", image_name, \":\", num_labels)\n",
"\n",
" return f\"The label image {image_name} contains {num_labels} labels.\"\n",
"\n",
"tools.append(Tool(\n",
" name=\"Count objects\",\n",
Expand Down Expand Up @@ -387,13 +388,13 @@
"name": "stdout",
"output_type": "stream",
"text": [
"counting labels in segmented_../../data/blobs.tif\n"
"counting labels in segmented_../../data/blobs.tif : 64\n"
]
},
{
"data": {
"text/plain": [
"'The segmented image ../../data/blobs.tif contains 64 objects.'"
"'The segmented ../../data/blobs.tif image contains 64 objects.'"
]
},
"execution_count": 13,
Expand Down Expand Up @@ -441,7 +442,7 @@
"text": [
"loading ../../data/blobs.tif\n",
"segmenting ../../data/blobs.tif\n",
"counting labels in segmented_../../data/blobs.tif\n",
"counting labels in segmented_../../data/blobs.tif : 64\n",
"showing segmented_../../data/blobs.tif\n"
]
},
Expand Down Expand Up @@ -482,7 +483,7 @@
{
"data": {
"text/plain": [
"'The segmented image contains 64 objects.'"
"'The segmented image of ../../data/blobs.tif contains 64 objects.'"
]
},
"execution_count": 15,
Expand Down

0 comments on commit 533a689

Please sign in to comment.