Skip to content

Commit 289890b

Browse files
adding example
1 parent ad564af commit 289890b

File tree

1 file changed

+162
-0
lines changed

1 file changed

+162
-0
lines changed

example.ipynb

+162
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {
7+
"id": "CYoE3LwMHtKm"
8+
},
9+
"outputs": [],
10+
"source": [
11+
"!pip install fiftyone pyvips-binary pyvips"
12+
]
13+
},
14+
{
15+
"cell_type": "code",
16+
"execution_count": null,
17+
"metadata": {
18+
"id": "29rFisXUH9ye"
19+
},
20+
"outputs": [],
21+
"source": [
22+
"import fiftyone as fo\n",
23+
"import fiftyone.zoo as foz\n",
24+
"\n",
25+
"dataset = foz.load_zoo_dataset(\"quickstart\")"
26+
]
27+
},
28+
{
29+
"cell_type": "code",
30+
"source": [
31+
"!fiftyone plugins download https://github.com/harpreetsahota204/moondream2-plugin"
32+
],
33+
"metadata": {
34+
"id": "QS-XAvTcE9Ho"
35+
},
36+
"execution_count": null,
37+
"outputs": []
38+
},
39+
{
40+
"cell_type": "code",
41+
"source": [
42+
"fo.launch_app(dataset)"
43+
],
44+
"metadata": {
45+
"id": "Dx1OanBGFqER"
46+
},
47+
"execution_count": null,
48+
"outputs": []
49+
},
50+
{
51+
"cell_type": "code",
52+
"source": [
53+
"import fiftyone.operators as foo\n",
54+
"\n",
55+
"moondream_operator = foo.get_operator(\"@harpreetsahota/moondream2/moondream\")"
56+
],
57+
"metadata": {
58+
"id": "JjzqoOg8olSJ"
59+
},
60+
"execution_count": null,
61+
"outputs": []
62+
},
63+
{
64+
"cell_type": "code",
65+
"source": [
66+
"await moondream_operator(\n",
67+
" dataset,\n",
68+
" revision=\"2025-01-09\",\n",
69+
" operation=\"caption\",\n",
70+
" output_field=\"moondream_caption\",\n",
71+
" delegate=True,\n",
72+
" length=\"short\"\n",
73+
")"
74+
],
75+
"metadata": {
76+
"id": "7exONRcaoZxc"
77+
},
78+
"execution_count": null,
79+
"outputs": []
80+
},
81+
{
82+
"cell_type": "code",
83+
"source": [
84+
"await moondream_operator(\n",
85+
" dataset,\n",
86+
" revision=\"2025-01-09\",\n",
87+
" operation=\"detect\",\n",
88+
" output_field=\"moondream_detections\",\n",
89+
" delegate=True,\n",
90+
" object_type=\"things\"\n",
91+
")"
92+
],
93+
"metadata": {
94+
"id": "Av4hAsdyo2VO"
95+
},
96+
"execution_count": null,
97+
"outputs": []
98+
},
99+
{
100+
"cell_type": "code",
101+
"source": [
102+
"await moondream_operator(\n",
103+
" dataset,\n",
104+
" revision=\"2025-01-09\",\n",
105+
" operation=\"point\",\n",
106+
" output_field=\"moondream_point\",\n",
107+
" delegate=True,\n",
108+
" object_type=\"stuff\"\n",
109+
")"
110+
],
111+
"metadata": {
112+
"id": "ZT1CV9OPrFol"
113+
},
114+
"execution_count": null,
115+
"outputs": []
116+
},
117+
{
118+
"cell_type": "code",
119+
"source": [
120+
"await moondream_operator(\n",
121+
" dataset,\n",
122+
" revision=\"2025-01-09\",\n",
123+
" operation=\"query\",\n",
124+
" output_field=\"moondream_answer\",\n",
125+
" delegate=True,\n",
126+
" query_text=\"What is the intearction between things and stuff in this image?\"\n",
127+
")"
128+
],
129+
"metadata": {
130+
"id": "oMAIBTCsrVt2"
131+
},
132+
"execution_count": null,
133+
"outputs": []
134+
},
135+
{
136+
"cell_type": "code",
137+
"source": [],
138+
"metadata": {
139+
"id": "Xj2WlpMzrmpf"
140+
},
141+
"execution_count": null,
142+
"outputs": []
143+
}
144+
],
145+
"metadata": {
146+
"accelerator": "GPU",
147+
"colab": {
148+
"gpuType": "L4",
149+
"machine_shape": "hm",
150+
"provenance": []
151+
},
152+
"kernelspec": {
153+
"display_name": "Python 3",
154+
"name": "python3"
155+
},
156+
"language_info": {
157+
"name": "python"
158+
}
159+
},
160+
"nbformat": 4,
161+
"nbformat_minor": 0
162+
}

0 commit comments

Comments
 (0)