Skip to content

Commit

Permalink
Merge pull request #246 from clEsperanto/bia-bob-suggestions
Browse files Browse the repository at this point in the history
Bia bob suggestions
  • Loading branch information
StRigaud authored Sep 29, 2024
2 parents bfe5dff + 3781bff commit 5e35602
Show file tree
Hide file tree
Showing 4 changed files with 1,067 additions and 0 deletions.
110 changes: 110 additions & 0 deletions demos/interoperability/biabob-example.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "6202a27d-1ca0-4261-b010-2eb8681b6f2f",
"metadata": {},
"source": [
"# AI-based code suggestions: bia-bob\n",
"\n",
"The [bia-bob project](https://github.com/haesleinhuepf/bia-bob) allows to use large language models for generating code in Jupyter notebooks. bia-bob is aware of pyclesperanto and can guide you how to use it. Just write your prompt below \"%%bob\", e.g. mentioning that you want to use GPU-acceleration for image processing and it may suggest using pyclesperanto."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "583c4b86-d763-4a56-84c0-3108fc7a9c86",
"metadata": {},
"outputs": [],
"source": [
"import bia_bob"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "84948b45-2f81-46c5-9038-885ddc53a24d",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"image = np.random.random((20,20))"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "60b42d69-dc92-41db-89ab-c93f0ec234f1",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" <div style=\"font-size:7pt\">\n",
" This notebook may contain text, code and images generated by artificial intelligence.\n",
" Used model: gpt-4o-2024-08-06, vision model: gpt-4o-2024-08-06, endpoint: None, bia-bob version: 0.23.1.. Do not enter sensitive or private information and verify generated contents according to good scientific practice. Read more: <a href=\"https://github.com/haesleinhuepf/bia-bob#disclaimer\">https://github.com/haesleinhuepf/bia-bob#disclaimer</a>\n",
" </div>\n",
" "
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%bob \n",
"Apply a GPU-accelerated Gaussian blur to the `image` and show the result"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7201b7b3-0981-41b3-af9d-ffe5bf6c8fe9",
"metadata": {},
"outputs": [],
"source": [
"import pyclesperanto as cle\n",
"import stackview\n",
"\n",
"# Apply Gaussian blur\n",
"blurred_image = cle.gaussian_blur(image, sigma_x=2, sigma_y=2, sigma_z=0)\n",
"\n",
"# Show the result\n",
"stackview.insight(blurred_image)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5786dfe9-c944-4b3b-86c4-65b95e778fcb",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 5e35602

Please sign in to comment.