Spaces:
Sleeping
Sleeping
Commit
·
b692acf
1
Parent(s):
03ca356
added import
Browse files- Deadpool-Detector.ipynb +117 -63
- app.py +1 -1
Deadpool-Detector.ipynb
CHANGED
@@ -104,7 +104,6 @@
|
|
104 |
]
|
105 |
},
|
106 |
{
|
107 |
-
"attachments": {},
|
108 |
"cell_type": "markdown",
|
109 |
"id": "792d8a70",
|
110 |
"metadata": {},
|
@@ -183,14 +182,14 @@
|
|
183 |
},
|
184 |
{
|
185 |
"cell_type": "code",
|
186 |
-
"execution_count":
|
187 |
"id": "f678e4ce-6b99-45b2-ae12-3e3a6978fe0a",
|
188 |
"metadata": {},
|
189 |
"outputs": [
|
190 |
{
|
191 |
"data": {
|
192 |
"application/vnd.jupyter.widget-view+json": {
|
193 |
-
"model_id": "
|
194 |
"version_major": 2,
|
195 |
"version_minor": 0
|
196 |
},
|
@@ -200,77 +199,34 @@
|
|
200 |
},
|
201 |
"metadata": {},
|
202 |
"output_type": "display_data"
|
203 |
-
},
|
204 |
-
{
|
205 |
-
"data": {
|
206 |
-
"application/vnd.jupyter.widget-view+json": {
|
207 |
-
"model_id": "86445259808342c7895ef51c3c30a27b",
|
208 |
-
"version_major": 2,
|
209 |
-
"version_minor": 0
|
210 |
-
},
|
211 |
-
"text/plain": [
|
212 |
-
"Downloading (…)3b40e/.gitattributes: 0%| | 0.00/1.48k [00:00<?, ?B/s]"
|
213 |
-
]
|
214 |
-
},
|
215 |
-
"metadata": {},
|
216 |
-
"output_type": "display_data"
|
217 |
-
},
|
218 |
-
{
|
219 |
-
"data": {
|
220 |
-
"application/vnd.jupyter.widget-view+json": {
|
221 |
-
"model_id": "0f5c6206271041c2b3d978afff8af373",
|
222 |
-
"version_major": 2,
|
223 |
-
"version_minor": 0
|
224 |
-
},
|
225 |
-
"text/plain": [
|
226 |
-
"Downloading (…)4d02d3b40e/README.md: 0%| | 0.00/768 [00:00<?, ?B/s]"
|
227 |
-
]
|
228 |
-
},
|
229 |
-
"metadata": {},
|
230 |
-
"output_type": "display_data"
|
231 |
-
},
|
232 |
-
{
|
233 |
-
"data": {
|
234 |
-
"application/vnd.jupyter.widget-view+json": {
|
235 |
-
"model_id": "576a45913eff4216bac8db9e6a3bd8f5",
|
236 |
-
"version_major": 2,
|
237 |
-
"version_minor": 0
|
238 |
-
},
|
239 |
-
"text/plain": [
|
240 |
-
"Downloading (…)3b40e/pyproject.toml: 0%| | 0.00/162 [00:00<?, ?B/s]"
|
241 |
-
]
|
242 |
-
},
|
243 |
-
"metadata": {},
|
244 |
-
"output_type": "display_data"
|
245 |
-
},
|
246 |
-
{
|
247 |
-
"data": {
|
248 |
-
"application/vnd.jupyter.widget-view+json": {
|
249 |
-
"model_id": "c847d69e1eab41b6bc51f1e65124ed5f",
|
250 |
-
"version_major": 2,
|
251 |
-
"version_minor": 0
|
252 |
-
},
|
253 |
-
"text/plain": [
|
254 |
-
"Downloading model.pkl: 0%| | 0.00/88.7M [00:00<?, ?B/s]"
|
255 |
-
]
|
256 |
-
},
|
257 |
-
"metadata": {},
|
258 |
-
"output_type": "display_data"
|
259 |
}
|
260 |
],
|
261 |
"source": [
|
262 |
"#|export\n",
|
|
|
263 |
"from huggingface_hub import from_pretrained_fastai\n",
|
264 |
"\n",
|
265 |
-
"
|
266 |
]
|
267 |
},
|
268 |
{
|
269 |
"cell_type": "code",
|
270 |
-
"execution_count":
|
271 |
"id": "cc0fa8a2-51fe-4591-9056-e84e0fec9af7",
|
272 |
"metadata": {},
|
273 |
-
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
274 |
"source": [
|
275 |
"#|export\n",
|
276 |
"labels = learn.dls.vocab\n",
|
@@ -414,7 +370,105 @@
|
|
414 |
},
|
415 |
"widgets": {
|
416 |
"application/vnd.jupyter.widget-state+json": {
|
417 |
-
"state": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
418 |
"version_major": 2,
|
419 |
"version_minor": 0
|
420 |
}
|
|
|
104 |
]
|
105 |
},
|
106 |
{
|
|
|
107 |
"cell_type": "markdown",
|
108 |
"id": "792d8a70",
|
109 |
"metadata": {},
|
|
|
182 |
},
|
183 |
{
|
184 |
"cell_type": "code",
|
185 |
+
"execution_count": 1,
|
186 |
"id": "f678e4ce-6b99-45b2-ae12-3e3a6978fe0a",
|
187 |
"metadata": {},
|
188 |
"outputs": [
|
189 |
{
|
190 |
"data": {
|
191 |
"application/vnd.jupyter.widget-view+json": {
|
192 |
+
"model_id": "7d156bf36fe9401e94bdc607db87cbee",
|
193 |
"version_major": 2,
|
194 |
"version_minor": 0
|
195 |
},
|
|
|
199 |
},
|
200 |
"metadata": {},
|
201 |
"output_type": "display_data"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
202 |
}
|
203 |
],
|
204 |
"source": [
|
205 |
"#|export\n",
|
206 |
+
"from fastai.vision.all import *\n",
|
207 |
"from huggingface_hub import from_pretrained_fastai\n",
|
208 |
"\n",
|
209 |
+
"learn = from_pretrained_fastai(\"jeffreymjohnson/Deadpool-Detector\")"
|
210 |
]
|
211 |
},
|
212 |
{
|
213 |
"cell_type": "code",
|
214 |
+
"execution_count": 2,
|
215 |
"id": "cc0fa8a2-51fe-4591-9056-e84e0fec9af7",
|
216 |
"metadata": {},
|
217 |
+
"outputs": [
|
218 |
+
{
|
219 |
+
"ename": "NameError",
|
220 |
+
"evalue": "name 'learn' is not defined",
|
221 |
+
"output_type": "error",
|
222 |
+
"traceback": [
|
223 |
+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
|
224 |
+
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
|
225 |
+
"Cell \u001b[0;32mIn[2], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m#|export\u001b[39;00m\n\u001b[0;32m----> 2\u001b[0m labels \u001b[38;5;241m=\u001b[39m \u001b[43mlearn\u001b[49m\u001b[38;5;241m.\u001b[39mdls\u001b[38;5;241m.\u001b[39mvocab\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mpredict\u001b[39m(img):\n\u001b[1;32m 4\u001b[0m yes_reaction \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mreactions/yes.jfif\u001b[39m\u001b[38;5;124m\"\u001b[39m\n",
|
226 |
+
"\u001b[0;31mNameError\u001b[0m: name 'learn' is not defined"
|
227 |
+
]
|
228 |
+
}
|
229 |
+
],
|
230 |
"source": [
|
231 |
"#|export\n",
|
232 |
"labels = learn.dls.vocab\n",
|
|
|
370 |
},
|
371 |
"widgets": {
|
372 |
"application/vnd.jupyter.widget-state+json": {
|
373 |
+
"state": {
|
374 |
+
"471e25d4adc54a7b971d0064b5c31d4e": {
|
375 |
+
"model_module": "@jupyter-widgets/controls",
|
376 |
+
"model_module_version": "2.0.0",
|
377 |
+
"model_name": "HTMLModel",
|
378 |
+
"state": {
|
379 |
+
"layout": "IPY_MODEL_62adce359c2841ed809d1671b8f7aa78",
|
380 |
+
"style": "IPY_MODEL_f3db0255d2734feb8dcaf68ca698f6d8",
|
381 |
+
"value": " 4/4 [00:00<00:00, 251.70it/s]"
|
382 |
+
}
|
383 |
+
},
|
384 |
+
"4eee542749dd4a14bc00539ed22854aa": {
|
385 |
+
"model_module": "@jupyter-widgets/base",
|
386 |
+
"model_module_version": "2.0.0",
|
387 |
+
"model_name": "LayoutModel",
|
388 |
+
"state": {}
|
389 |
+
},
|
390 |
+
"503423ce35254544bc26df135dc3b2b7": {
|
391 |
+
"model_module": "@jupyter-widgets/base",
|
392 |
+
"model_module_version": "2.0.0",
|
393 |
+
"model_name": "LayoutModel",
|
394 |
+
"state": {}
|
395 |
+
},
|
396 |
+
"560af530483a40f5b6965fd40a735554": {
|
397 |
+
"model_module": "@jupyter-widgets/controls",
|
398 |
+
"model_module_version": "2.0.0",
|
399 |
+
"model_name": "HTMLStyleModel",
|
400 |
+
"state": {
|
401 |
+
"description_width": "",
|
402 |
+
"font_size": null,
|
403 |
+
"text_color": null
|
404 |
+
}
|
405 |
+
},
|
406 |
+
"5cde88a9faea419bb1148823382105cc": {
|
407 |
+
"model_module": "@jupyter-widgets/controls",
|
408 |
+
"model_module_version": "2.0.0",
|
409 |
+
"model_name": "ProgressStyleModel",
|
410 |
+
"state": {
|
411 |
+
"description_width": ""
|
412 |
+
}
|
413 |
+
},
|
414 |
+
"62adce359c2841ed809d1671b8f7aa78": {
|
415 |
+
"model_module": "@jupyter-widgets/base",
|
416 |
+
"model_module_version": "2.0.0",
|
417 |
+
"model_name": "LayoutModel",
|
418 |
+
"state": {}
|
419 |
+
},
|
420 |
+
"70dfbcb89d1142b5bf5113ac1ed7adae": {
|
421 |
+
"model_module": "@jupyter-widgets/controls",
|
422 |
+
"model_module_version": "2.0.0",
|
423 |
+
"model_name": "HTMLModel",
|
424 |
+
"state": {
|
425 |
+
"layout": "IPY_MODEL_503423ce35254544bc26df135dc3b2b7",
|
426 |
+
"style": "IPY_MODEL_560af530483a40f5b6965fd40a735554",
|
427 |
+
"value": "Fetching 4 files: 100%"
|
428 |
+
}
|
429 |
+
},
|
430 |
+
"7d156bf36fe9401e94bdc607db87cbee": {
|
431 |
+
"model_module": "@jupyter-widgets/controls",
|
432 |
+
"model_module_version": "2.0.0",
|
433 |
+
"model_name": "HBoxModel",
|
434 |
+
"state": {
|
435 |
+
"children": [
|
436 |
+
"IPY_MODEL_70dfbcb89d1142b5bf5113ac1ed7adae",
|
437 |
+
"IPY_MODEL_9bc68c569c764547a4f80a8fa97c1f17",
|
438 |
+
"IPY_MODEL_471e25d4adc54a7b971d0064b5c31d4e"
|
439 |
+
],
|
440 |
+
"layout": "IPY_MODEL_4eee542749dd4a14bc00539ed22854aa"
|
441 |
+
}
|
442 |
+
},
|
443 |
+
"95f5191753fc43eaba2883aafcb9df5d": {
|
444 |
+
"model_module": "@jupyter-widgets/base",
|
445 |
+
"model_module_version": "2.0.0",
|
446 |
+
"model_name": "LayoutModel",
|
447 |
+
"state": {}
|
448 |
+
},
|
449 |
+
"9bc68c569c764547a4f80a8fa97c1f17": {
|
450 |
+
"model_module": "@jupyter-widgets/controls",
|
451 |
+
"model_module_version": "2.0.0",
|
452 |
+
"model_name": "FloatProgressModel",
|
453 |
+
"state": {
|
454 |
+
"bar_style": "success",
|
455 |
+
"layout": "IPY_MODEL_95f5191753fc43eaba2883aafcb9df5d",
|
456 |
+
"max": 4,
|
457 |
+
"style": "IPY_MODEL_5cde88a9faea419bb1148823382105cc",
|
458 |
+
"value": 4
|
459 |
+
}
|
460 |
+
},
|
461 |
+
"f3db0255d2734feb8dcaf68ca698f6d8": {
|
462 |
+
"model_module": "@jupyter-widgets/controls",
|
463 |
+
"model_module_version": "2.0.0",
|
464 |
+
"model_name": "HTMLStyleModel",
|
465 |
+
"state": {
|
466 |
+
"description_width": "",
|
467 |
+
"font_size": null,
|
468 |
+
"text_color": null
|
469 |
+
}
|
470 |
+
}
|
471 |
+
},
|
472 |
"version_major": 2,
|
473 |
"version_minor": 0
|
474 |
}
|
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
|
|
1 |
from huggingface_hub import from_pretrained_fastai
|
2 |
-
import gradio as gr
|
3 |
|
4 |
learn = from_pretrained_fastai("jeffreymjohnson/Deadpool-Detector")
|
5 |
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
from huggingface_hub import from_pretrained_fastai
|
|
|
3 |
|
4 |
learn = from_pretrained_fastai("jeffreymjohnson/Deadpool-Detector")
|
5 |
|