pol-avec commited on
Commit
d0e95f4
·
1 Parent(s): 2ba57db

initial cat commit

Browse files
Files changed (1) hide show
  1. cat-app-v2.ipynb +524 -0
cat-app-v2.ipynb ADDED
@@ -0,0 +1,524 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "#hide\n",
10
+ "! [ -e /content ] && pip install -Uqq fastbook\n",
11
+ "import fastbook\n",
12
+ "fastbook.setup_book()"
13
+ ]
14
+ },
15
+ {
16
+ "cell_type": "code",
17
+ "execution_count": 2,
18
+ "metadata": {},
19
+ "outputs": [],
20
+ "source": [
21
+ "#hide\n",
22
+ "from fastbook import *\n",
23
+ "from fastai.vision.widgets import *"
24
+ ]
25
+ },
26
+ {
27
+ "cell_type": "markdown",
28
+ "metadata": {},
29
+ "source": [
30
+ "## Turning Your Model into an Online Application"
31
+ ]
32
+ },
33
+ {
34
+ "cell_type": "code",
35
+ "execution_count": 3,
36
+ "metadata": {},
37
+ "outputs": [
38
+ {
39
+ "data": {
40
+ "text/plain": [
41
+ "(#1) [Path('model_cat_garden.pkl')]"
42
+ ]
43
+ },
44
+ "execution_count": 3,
45
+ "metadata": {},
46
+ "output_type": "execute_result"
47
+ }
48
+ ],
49
+ "source": [
50
+ "path = Path()\n",
51
+ "path.ls(file_exts='.pkl')"
52
+ ]
53
+ },
54
+ {
55
+ "cell_type": "code",
56
+ "execution_count": 4,
57
+ "metadata": {},
58
+ "outputs": [],
59
+ "source": [
60
+ "learn_inf = load_learner('model_cat_garden.pkl')"
61
+ ]
62
+ },
63
+ {
64
+ "cell_type": "code",
65
+ "execution_count": 5,
66
+ "metadata": {},
67
+ "outputs": [
68
+ {
69
+ "data": {
70
+ "text/plain": [
71
+ "['faraway cat in garden', 'garden']"
72
+ ]
73
+ },
74
+ "execution_count": 5,
75
+ "metadata": {},
76
+ "output_type": "execute_result"
77
+ }
78
+ ],
79
+ "source": [
80
+ "learn_inf.dls.vocab"
81
+ ]
82
+ },
83
+ {
84
+ "cell_type": "markdown",
85
+ "metadata": {},
86
+ "source": [
87
+ "### Creating a Notebook App from the Model"
88
+ ]
89
+ },
90
+ {
91
+ "cell_type": "code",
92
+ "execution_count": 6,
93
+ "metadata": {},
94
+ "outputs": [
95
+ {
96
+ "data": {
97
+ "application/vnd.jupyter.widget-view+json": {
98
+ "model_id": "390263efa38e4784826c89433119c69f",
99
+ "version_major": 2,
100
+ "version_minor": 0
101
+ },
102
+ "text/plain": [
103
+ "FileUpload(value={}, description='Upload')"
104
+ ]
105
+ },
106
+ "metadata": {},
107
+ "output_type": "display_data"
108
+ }
109
+ ],
110
+ "source": [
111
+ "btn_upload = widgets.FileUpload()\n",
112
+ "btn_upload"
113
+ ]
114
+ },
115
+ {
116
+ "cell_type": "code",
117
+ "execution_count": 9,
118
+ "metadata": {},
119
+ "outputs": [],
120
+ "source": [
121
+ "img = btn_upload.data[-1]\n"
122
+ ]
123
+ },
124
+ {
125
+ "cell_type": "code",
126
+ "execution_count": 10,
127
+ "metadata": {},
128
+ "outputs": [
129
+ {
130
+ "data": {
131
+ "application/vnd.jupyter.widget-view+json": {
132
+ "model_id": "6fd1aecb19774416a522049b8ecd84b9",
133
+ "version_major": 2,
134
+ "version_minor": 0
135
+ },
136
+ "text/plain": [
137
+ "Output()"
138
+ ]
139
+ },
140
+ "metadata": {},
141
+ "output_type": "display_data"
142
+ }
143
+ ],
144
+ "source": [
145
+ "out_pl = widgets.Output()\n",
146
+ "out_pl.clear_output()\n",
147
+ "with out_pl: display(PILImage.create(img).to_thumb(128,128))\n",
148
+ "out_pl"
149
+ ]
150
+ },
151
+ {
152
+ "cell_type": "code",
153
+ "execution_count": 11,
154
+ "metadata": {},
155
+ "outputs": [
156
+ {
157
+ "data": {
158
+ "text/html": [
159
+ "\n",
160
+ "<style>\n",
161
+ " /* Turns off some styling */\n",
162
+ " progress {\n",
163
+ " /* gets rid of default border in Firefox and Opera. */\n",
164
+ " border: none;\n",
165
+ " /* Needs to be in here for Safari polyfill so background images work as expected. */\n",
166
+ " background-size: auto;\n",
167
+ " }\n",
168
+ " progress:not([value]), progress:not([value])::-webkit-progress-bar {\n",
169
+ " background: repeating-linear-gradient(45deg, #7e7e7e, #7e7e7e 10px, #5c5c5c 10px, #5c5c5c 20px);\n",
170
+ " }\n",
171
+ " .progress-bar-interrupted, .progress-bar-interrupted::-webkit-progress-bar {\n",
172
+ " background: #F44336;\n",
173
+ " }\n",
174
+ "</style>\n"
175
+ ],
176
+ "text/plain": [
177
+ "<IPython.core.display.HTML object>"
178
+ ]
179
+ },
180
+ "metadata": {},
181
+ "output_type": "display_data"
182
+ },
183
+ {
184
+ "data": {
185
+ "text/html": [],
186
+ "text/plain": [
187
+ "<IPython.core.display.HTML object>"
188
+ ]
189
+ },
190
+ "metadata": {},
191
+ "output_type": "display_data"
192
+ }
193
+ ],
194
+ "source": [
195
+ "pred,pred_idx,probs = learn_inf.predict(btn_upload.data[-1])"
196
+ ]
197
+ },
198
+ {
199
+ "cell_type": "code",
200
+ "execution_count": 12,
201
+ "metadata": {},
202
+ "outputs": [
203
+ {
204
+ "data": {
205
+ "application/vnd.jupyter.widget-view+json": {
206
+ "model_id": "4f1034eb5de848a28d71a0456f65c524",
207
+ "version_major": 2,
208
+ "version_minor": 0
209
+ },
210
+ "text/plain": [
211
+ "Label(value='Prediction: faraway cat in garden; Probability: 0.8835')"
212
+ ]
213
+ },
214
+ "metadata": {},
215
+ "output_type": "display_data"
216
+ }
217
+ ],
218
+ "source": [
219
+ "lbl_pred = widgets.Label()\n",
220
+ "lbl_pred.value = f'Prediction: {pred}; Probability: {probs[pred_idx]:.04f}'\n",
221
+ "lbl_pred"
222
+ ]
223
+ },
224
+ {
225
+ "cell_type": "code",
226
+ "execution_count": 13,
227
+ "metadata": {},
228
+ "outputs": [
229
+ {
230
+ "data": {
231
+ "application/vnd.jupyter.widget-view+json": {
232
+ "model_id": "00231df17dac4cfa87e3cdc9d0017ce3",
233
+ "version_major": 2,
234
+ "version_minor": 0
235
+ },
236
+ "text/plain": [
237
+ "Button(description='Classify', style=ButtonStyle())"
238
+ ]
239
+ },
240
+ "metadata": {},
241
+ "output_type": "display_data"
242
+ }
243
+ ],
244
+ "source": [
245
+ "btn_run = widgets.Button(description='Classify')\n",
246
+ "btn_run"
247
+ ]
248
+ },
249
+ {
250
+ "cell_type": "code",
251
+ "execution_count": 14,
252
+ "metadata": {},
253
+ "outputs": [],
254
+ "source": [
255
+ "def on_click_classify(change):\n",
256
+ " img = btn_upload.data[-1]\n",
257
+ " out_pl.clear_output()\n",
258
+ " with out_pl: display(PILImage.create(img).to_thumb(128,128))\n",
259
+ " pred,pred_idx,probs = learn_inf.predict(img)\n",
260
+ " lbl_pred.value = f'Prediction: {pred}; Probability: {probs[pred_idx]:.04f}'\n",
261
+ "\n",
262
+ "btn_run.on_click(on_click_classify)"
263
+ ]
264
+ },
265
+ {
266
+ "cell_type": "code",
267
+ "execution_count": 15,
268
+ "metadata": {},
269
+ "outputs": [],
270
+ "source": [
271
+ "#hide\n",
272
+ "#Putting back btn_upload to a widget for next cell\n",
273
+ "btn_upload = widgets.FileUpload()"
274
+ ]
275
+ },
276
+ {
277
+ "cell_type": "code",
278
+ "execution_count": 16,
279
+ "metadata": {},
280
+ "outputs": [
281
+ {
282
+ "data": {
283
+ "application/vnd.jupyter.widget-view+json": {
284
+ "model_id": "af0b23b36a574540854829445cc70016",
285
+ "version_major": 2,
286
+ "version_minor": 0
287
+ },
288
+ "text/plain": [
289
+ "VBox(children=(Label(value='Select your bear!'), FileUpload(value={}, description='Upload'), Button(descriptio…"
290
+ ]
291
+ },
292
+ "metadata": {},
293
+ "output_type": "display_data"
294
+ }
295
+ ],
296
+ "source": [
297
+ "VBox([widgets.Label('Select your bear!'), \n",
298
+ " btn_upload, btn_run, out_pl, lbl_pred])"
299
+ ]
300
+ },
301
+ {
302
+ "cell_type": "markdown",
303
+ "metadata": {},
304
+ "source": [
305
+ "### Turning Your Notebook into a Real App"
306
+ ]
307
+ },
308
+ {
309
+ "cell_type": "code",
310
+ "execution_count": 19,
311
+ "metadata": {},
312
+ "outputs": [
313
+ {
314
+ "name": "stdout",
315
+ "output_type": "stream",
316
+ "text": [
317
+ "Requirement already satisfied: voila in /Users/ahriman/mambaforge/lib/python3.10/site-packages (0.4.0)\n",
318
+ "Requirement already satisfied: jupyter-core>=4.11.0 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from voila) (5.3.0)\n",
319
+ "Requirement already satisfied: nbclient<0.8,>=0.4.0 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from voila) (0.7.3)\n",
320
+ "Requirement already satisfied: websockets>=9.0 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from voila) (11.0.1)\n",
321
+ "Requirement already satisfied: jupyterlab-server<3,>=2.3.0 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from voila) (2.22.0)\n",
322
+ "Requirement already satisfied: nbconvert<8,>=6.4.5 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from voila) (7.3.1)\n",
323
+ "Requirement already satisfied: jupyter-client<=7.4.1,>=6.1.3 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from voila) (7.4.1)\n",
324
+ "Requirement already satisfied: jupyter-server<2.0.0,>=1.18 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from voila) (1.23.6)\n",
325
+ "Requirement already satisfied: traitlets<6,>=5.0.3 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from voila) (5.9.0)\n",
326
+ "Requirement already satisfied: nest-asyncio>=1.5.4 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyter-client<=7.4.1,>=6.1.3->voila) (1.5.6)\n",
327
+ "Requirement already satisfied: entrypoints in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyter-client<=7.4.1,>=6.1.3->voila) (0.4)\n",
328
+ "Requirement already satisfied: pyzmq>=23.0 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyter-client<=7.4.1,>=6.1.3->voila) (25.0.2)\n",
329
+ "Requirement already satisfied: tornado>=6.2 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyter-client<=7.4.1,>=6.1.3->voila) (6.2)\n",
330
+ "Requirement already satisfied: python-dateutil>=2.8.2 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyter-client<=7.4.1,>=6.1.3->voila) (2.8.2)\n",
331
+ "Requirement already satisfied: platformdirs>=2.5 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyter-core>=4.11.0->voila) (3.2.0)\n",
332
+ "Requirement already satisfied: anyio<4,>=3.1.0 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyter-server<2.0.0,>=1.18->voila) (3.6.2)\n",
333
+ "Requirement already satisfied: prometheus-client in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyter-server<2.0.0,>=1.18->voila) (0.16.0)\n",
334
+ "Requirement already satisfied: websocket-client in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyter-server<2.0.0,>=1.18->voila) (1.5.1)\n",
335
+ "Requirement already satisfied: packaging in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyter-server<2.0.0,>=1.18->voila) (23.0)\n",
336
+ "Requirement already satisfied: jinja2 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyter-server<2.0.0,>=1.18->voila) (3.1.2)\n",
337
+ "Requirement already satisfied: terminado>=0.8.3 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyter-server<2.0.0,>=1.18->voila) (0.17.1)\n",
338
+ "Requirement already satisfied: nbformat>=5.2.0 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyter-server<2.0.0,>=1.18->voila) (5.8.0)\n",
339
+ "Requirement already satisfied: Send2Trash in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyter-server<2.0.0,>=1.18->voila) (1.8.0)\n",
340
+ "Requirement already satisfied: argon2-cffi in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyter-server<2.0.0,>=1.18->voila) (21.3.0)\n",
341
+ "Requirement already satisfied: json5>=0.9.0 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyterlab-server<3,>=2.3.0->voila) (0.9.11)\n",
342
+ "Requirement already satisfied: requests>=2.28 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyterlab-server<3,>=2.3.0->voila) (2.28.2)\n",
343
+ "Requirement already satisfied: jsonschema>=4.17.3 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyterlab-server<3,>=2.3.0->voila) (4.17.3)\n",
344
+ "Requirement already satisfied: babel>=2.10 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jupyterlab-server<3,>=2.3.0->voila) (2.12.1)\n",
345
+ "Requirement already satisfied: beautifulsoup4 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from nbconvert<8,>=6.4.5->voila) (4.12.2)\n",
346
+ "Requirement already satisfied: jupyterlab-pygments in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from nbconvert<8,>=6.4.5->voila) (0.2.2)\n",
347
+ "Requirement already satisfied: pandocfilters>=1.4.1 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from nbconvert<8,>=6.4.5->voila) (1.5.0)\n",
348
+ "Requirement already satisfied: tinycss2 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from nbconvert<8,>=6.4.5->voila) (1.2.1)\n",
349
+ "Requirement already satisfied: markupsafe>=2.0 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from nbconvert<8,>=6.4.5->voila) (2.1.2)\n",
350
+ "Requirement already satisfied: defusedxml in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from nbconvert<8,>=6.4.5->voila) (0.7.1)\n",
351
+ "Requirement already satisfied: pygments>=2.4.1 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from nbconvert<8,>=6.4.5->voila) (2.14.0)\n",
352
+ "Requirement already satisfied: bleach in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from nbconvert<8,>=6.4.5->voila) (6.0.0)\n",
353
+ "Requirement already satisfied: mistune<3,>=2.0.3 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from nbconvert<8,>=6.4.5->voila) (2.0.5)\n",
354
+ "Requirement already satisfied: idna>=2.8 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from anyio<4,>=3.1.0->jupyter-server<2.0.0,>=1.18->voila) (3.4)\n",
355
+ "Requirement already satisfied: sniffio>=1.1 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from anyio<4,>=3.1.0->jupyter-server<2.0.0,>=1.18->voila) (1.3.0)\n",
356
+ "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jsonschema>=4.17.3->jupyterlab-server<3,>=2.3.0->voila) (0.19.3)\n",
357
+ "Requirement already satisfied: attrs>=17.4.0 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from jsonschema>=4.17.3->jupyterlab-server<3,>=2.3.0->voila) (22.2.0)\n",
358
+ "Requirement already satisfied: fastjsonschema in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from nbformat>=5.2.0->jupyter-server<2.0.0,>=1.18->voila) (2.16.3)\n",
359
+ "Requirement already satisfied: six>=1.5 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from python-dateutil>=2.8.2->jupyter-client<=7.4.1,>=6.1.3->voila) (1.16.0)\n",
360
+ "Requirement already satisfied: urllib3<1.27,>=1.21.1 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from requests>=2.28->jupyterlab-server<3,>=2.3.0->voila) (1.26.15)\n",
361
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from requests>=2.28->jupyterlab-server<3,>=2.3.0->voila) (3.1.0)\n",
362
+ "Requirement already satisfied: certifi>=2017.4.17 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from requests>=2.28->jupyterlab-server<3,>=2.3.0->voila) (2022.12.7)\n",
363
+ "Requirement already satisfied: ptyprocess in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from terminado>=0.8.3->jupyter-server<2.0.0,>=1.18->voila) (0.7.0)\n",
364
+ "Requirement already satisfied: argon2-cffi-bindings in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from argon2-cffi->jupyter-server<2.0.0,>=1.18->voila) (21.2.0)\n",
365
+ "Requirement already satisfied: soupsieve>1.2 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from beautifulsoup4->nbconvert<8,>=6.4.5->voila) (2.4)\n",
366
+ "Requirement already satisfied: webencodings in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from bleach->nbconvert<8,>=6.4.5->voila) (0.5.1)\n",
367
+ "Requirement already satisfied: cffi>=1.0.1 in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from argon2-cffi-bindings->argon2-cffi->jupyter-server<2.0.0,>=1.18->voila) (1.15.1)\n",
368
+ "Requirement already satisfied: pycparser in /Users/ahriman/mambaforge/lib/python3.10/site-packages (from cffi>=1.0.1->argon2-cffi-bindings->argon2-cffi->jupyter-server<2.0.0,>=1.18->voila) (2.21)\n",
369
+ "Enabling: voila\n",
370
+ "- Writing config: /usr/local/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/etc/jupyter\n",
371
+ " - Validating...\n",
372
+ "Error loading server extension voila\n",
373
+ " \u001b[31m X\u001b[0m is voila importable?\n"
374
+ ]
375
+ }
376
+ ],
377
+ "source": [
378
+ "#hide\n",
379
+ "!pip3 install voila\n",
380
+ "!jupyter serverextension enable --sys-prefix voila "
381
+ ]
382
+ },
383
+ {
384
+ "cell_type": "code",
385
+ "execution_count": 8,
386
+ "metadata": {},
387
+ "outputs": [
388
+ {
389
+ "name": "stdout",
390
+ "output_type": "stream",
391
+ "text": [
392
+ "usage: jupyter-serverextension [-h] [--debug] [--show-config]\r\n",
393
+ " [--show-config-json] [--user] [--system]\r\n",
394
+ " [--sys-prefix] [--py] [--python]\r\n",
395
+ " [--log-level EnableServerExtensionApp.log_level]\r\n",
396
+ " [--config EnableServerExtensionApp.config_file]\r\n",
397
+ " [extra_args ...]\r\n",
398
+ "jupyter-serverextension: error: unrecognized arguments: -sys-prefix\r\n"
399
+ ]
400
+ }
401
+ ],
402
+ "source": [
403
+ "!jupyter serverextension enable --sys-prefix voila "
404
+ ]
405
+ },
406
+ {
407
+ "cell_type": "markdown",
408
+ "metadata": {},
409
+ "source": [
410
+ "## Questionnaire"
411
+ ]
412
+ },
413
+ {
414
+ "cell_type": "markdown",
415
+ "metadata": {},
416
+ "source": [
417
+ "1. Provide an example of where the bear classification model might work poorly in production, due to structural or style differences in the training data.\n",
418
+ "1. Where do text models currently have a major deficiency?\n",
419
+ "1. What are possible negative societal implications of text generation models?\n",
420
+ "1. In situations where a model might make mistakes, and those mistakes could be harmful, what is a good alternative to automating a process?\n",
421
+ "1. What kind of tabular data is deep learning particularly good at?\n",
422
+ "1. What's a key downside of directly using a deep learning model for recommendation systems?\n",
423
+ "1. What are the steps of the Drivetrain Approach?\n",
424
+ "1. How do the steps of the Drivetrain Approach map to a recommendation system?\n",
425
+ "1. Create an image recognition model using data you curate, and deploy it on the web.\n",
426
+ "1. What is `DataLoaders`?\n",
427
+ "1. What four things do we need to tell fastai to create `DataLoaders`?\n",
428
+ "1. What does the `splitter` parameter to `DataBlock` do?\n",
429
+ "1. How do we ensure a random split always gives the same validation set?\n",
430
+ "1. What letters are often used to signify the independent and dependent variables?\n",
431
+ "1. What's the difference between the crop, pad, and squish resize approaches? When might you choose one over the others?\n",
432
+ "1. What is data augmentation? Why is it needed?\n",
433
+ "1. What is the difference between `item_tfms` and `batch_tfms`?\n",
434
+ "1. What is a confusion matrix?\n",
435
+ "1. What does `export` save?\n",
436
+ "1. What is it called when we use a model for getting predictions, instead of training?\n",
437
+ "1. What are IPython widgets?\n",
438
+ "1. When might you want to use CPU for deployment? When might GPU be better?\n",
439
+ "1. What are the downsides of deploying your app to a server, instead of to a client (or edge) device such as a phone or PC?\n",
440
+ "1. What are three examples of problems that could occur when rolling out a bear warning system in practice?\n",
441
+ "1. What is \"out-of-domain data\"?\n",
442
+ "1. What is \"domain shift\"?\n",
443
+ "1. What are the three steps in the deployment process?"
444
+ ]
445
+ },
446
+ {
447
+ "cell_type": "markdown",
448
+ "metadata": {},
449
+ "source": [
450
+ "### Further Research"
451
+ ]
452
+ },
453
+ {
454
+ "cell_type": "markdown",
455
+ "metadata": {},
456
+ "source": [
457
+ "1. Consider how the Drivetrain Approach maps to a project or problem you're interested in.\n",
458
+ "1. When might it be best to avoid certain types of data augmentation?\n",
459
+ "1. For a project you're interested in applying deep learning to, consider the thought experiment \"What would happen if it went really, really well?\"\n",
460
+ "1. Start a blog, and write your first blog post. For instance, write about what you think deep learning might be useful for in a domain you're interested in."
461
+ ]
462
+ },
463
+ {
464
+ "cell_type": "code",
465
+ "execution_count": null,
466
+ "metadata": {},
467
+ "outputs": [],
468
+ "source": []
469
+ }
470
+ ],
471
+ "metadata": {
472
+ "jupytext": {
473
+ "split_at_heading": true
474
+ },
475
+ "kernelspec": {
476
+ "display_name": "Python 3 (ipykernel)",
477
+ "language": "python",
478
+ "name": "python3"
479
+ },
480
+ "language_info": {
481
+ "codemirror_mode": {
482
+ "name": "ipython",
483
+ "version": 3
484
+ },
485
+ "file_extension": ".py",
486
+ "mimetype": "text/x-python",
487
+ "name": "python",
488
+ "nbconvert_exporter": "python",
489
+ "pygments_lexer": "ipython3",
490
+ "version": "3.9.13"
491
+ },
492
+ "varInspector": {
493
+ "cols": {
494
+ "lenName": 16,
495
+ "lenType": 16,
496
+ "lenVar": 40
497
+ },
498
+ "kernels_config": {
499
+ "python": {
500
+ "delete_cmd_postfix": "",
501
+ "delete_cmd_prefix": "del ",
502
+ "library": "var_list.py",
503
+ "varRefreshCmd": "print(var_dic_list())"
504
+ },
505
+ "r": {
506
+ "delete_cmd_postfix": ") ",
507
+ "delete_cmd_prefix": "rm(",
508
+ "library": "var_list.r",
509
+ "varRefreshCmd": "cat(var_dic_list()) "
510
+ }
511
+ },
512
+ "types_to_exclude": [
513
+ "module",
514
+ "function",
515
+ "builtin_function_or_method",
516
+ "instance",
517
+ "_Feature"
518
+ ],
519
+ "window_display": false
520
+ }
521
+ },
522
+ "nbformat": 4,
523
+ "nbformat_minor": 4
524
+ }