Skip to content

Commit 0cd99c3

Browse files
authored
Added text prompt GUI (#80)
1 parent f0cecf9 commit 0cd99c3

File tree

5 files changed

+387
-26
lines changed

5 files changed

+387
-26
lines changed

docs/examples/text_prompts.ipynb

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@
3939
"metadata": {},
4040
"outputs": [],
4141
"source": [
42-
"import os\n",
4342
"import leafmap\n",
44-
"from samgeo import SamGeo, tms_to_geotiff\n",
43+
"from samgeo import tms_to_geotiff\n",
4544
"from samgeo.text_sam import LangSAM"
4645
]
4746
},
@@ -201,9 +200,9 @@
201200
"outputs": [],
202201
"source": [
203202
"sam.show_anns(\n",
204-
" cmap='Greens', \n",
205-
" box_color='red', \n",
206-
" title='Automatic Segmentation of Trees', \n",
203+
" cmap='Greens',\n",
204+
" box_color='red',\n",
205+
" title='Automatic Segmentation of Trees',\n",
207206
" blend=True,\n",
208207
")"
209208
]
@@ -229,10 +228,10 @@
229228
"outputs": [],
230229
"source": [
231230
"sam.show_anns(\n",
232-
" cmap='Greens', \n",
231+
" cmap='Greens',\n",
233232
" add_boxes=False,\n",
234233
" alpha=0.5,\n",
235-
" title='Automatic Segmentation of Trees', \n",
234+
" title='Automatic Segmentation of Trees',\n",
236235
")"
237236
]
238237
},
@@ -257,12 +256,12 @@
257256
"outputs": [],
258257
"source": [
259258
"sam.show_anns(\n",
260-
" cmap='Greys_r', \n",
259+
" cmap='Greys_r',\n",
261260
" add_boxes=False,\n",
262261
" alpha=1,\n",
263-
" title='Automatic Segmentation of Trees', \n",
262+
" title='Automatic Segmentation of Trees',\n",
264263
" blend=False,\n",
265-
" output='trees.tif'\n",
264+
" output='trees.tif',\n",
266265
")"
267266
]
268267
},
@@ -312,6 +311,29 @@
312311
"m.add_vector(\"trees.shp\", layer_name=\"Vector\", style=style)\n",
313312
"m"
314313
]
314+
},
315+
{
316+
"cell_type": "markdown",
317+
"metadata": {},
318+
"source": [
319+
"## Interactive segmentation"
320+
]
321+
},
322+
{
323+
"cell_type": "code",
324+
"execution_count": null,
325+
"metadata": {},
326+
"outputs": [],
327+
"source": [
328+
"sam.show_map()"
329+
]
330+
},
331+
{
332+
"cell_type": "markdown",
333+
"metadata": {},
334+
"source": [
335+
"![](https://i.imgur.com/wydt5Xt.gif)"
336+
]
315337
}
316338
],
317339
"metadata": {

0 commit comments

Comments
 (0)