Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway authored Jun 10, 2024
1 parent 51b31b9 commit 23783ba
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions notebooks/bioengine-tutorial-embl-2024.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"trusted": true
},
"outputs": [],
"execution_count": 2
"execution_count": 3
},
{
"cell_type": "code",
Expand All @@ -42,7 +42,7 @@
"trusted": true
},
"outputs": [],
"execution_count": 3
"execution_count": 4
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -70,7 +70,7 @@
"metadata": {}
}
],
"execution_count": 10
"execution_count": 5
},
{
"cell_type": "markdown",
Expand All @@ -85,7 +85,7 @@
"trusted": true
},
"outputs": [],
"execution_count": 11
"execution_count": 7
},
{
"cell_type": "markdown",
Expand All @@ -94,7 +94,7 @@
},
{
"cell_type": "code",
"source": "import json\nret = await triton.execute(inputs=[{'inputs': None, \"model_id\": \"creative-panda\", 'return_rdf':True}],\n model_name=\"bioengine-model-runner\",\n serialization=\"imjoy\",\n )\nrdf_content = ret['result']['rdf']\nprint(json.dumps(rdf_content, indent=4))",
"source": "import json\nret = await triton.execute(inputs=[{'inputs': None, \"model_id\": \"creative-panda\", 'return_rdf':True}],\n model_name=\"bioengine-model-runner\",\n serialization=\"imjoy\",\n )\nmodel_rdf = ret['result']['rdf']\nprint(json.dumps(model_rdf, indent=4))",
"metadata": {
"trusted": true
},
Expand All @@ -105,7 +105,27 @@
"output_type": "stream"
}
],
"execution_count": 17
"execution_count": 8
},
{
"cell_type": "markdown",
"source": "## Make sure the input image shape is valid",
"metadata": {}
},
{
"cell_type": "code",
"source": "input_image_shape = tuple(model_rdf[\"inputs\"][0][\"shape\"][1:])\nprint(\"Input image shape\", input_image_shape)\ninput_image = image[...,None]\nassert input_image.shape == input_image_shape, f\"Wrong shape ({input_image.shape}), expected: {input_image_shape}\"\nprint(\"Valid image shape, ready to go!\")",
"metadata": {
"trusted": true
},
"outputs": [
{
"name": "stdout",
"text": "Input image shape (512, 512, 1)\nValid image shape, ready to go!\n",
"output_type": "stream"
}
],
"execution_count": 28
},
{
"cell_type": "markdown",
Expand All @@ -114,7 +134,7 @@
},
{
"cell_type": "code",
"source": "ret = await triton.execute(inputs=[{\"inputs\":[[image[...,None]]], \"model_id\": \"creative-panda\"}],\n model_name=\"bioengine-model-runner\",\n serialization=\"imjoy\",\n )\nresult = ret[\"result\"]\nmask = result['outputs'][0]\nprint('prediction: ', mask.shape)",
"source": "ret = await triton.execute(inputs=[{\"inputs\":[[input_image]], \"model_id\": \"creative-panda\"}],\n model_name=\"bioengine-model-runner\",\n serialization=\"imjoy\",\n )\nresult = ret[\"result\"]\nmask = result['outputs'][0]\nprint('prediction: ', mask.shape)",
"metadata": {
"trusted": true
},
Expand All @@ -125,7 +145,7 @@
"output_type": "stream"
}
],
"execution_count": 13
"execution_count": 27
},
{
"cell_type": "markdown",
Expand Down

0 comments on commit 23783ba

Please sign in to comment.