Spaces:
Build error
Build error
anatexis
commited on
Commit
•
a90d782
1
Parent(s):
66a9092
let's deploy ninj classifier to huggingface spaces
Browse files- Cole.png +0 -0
- Lloyd.jpg +0 -0
- app.py +26 -0
- export_ninjago_classifier.pkl +3 -0
- labels.txt +126 -0
Cole.png
ADDED
![]() |
Lloyd.jpg
ADDED
![]() |
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import skimage
|
4 |
+
|
5 |
+
learn = load_learner('export_ninjago_classifier.pkl')
|
6 |
+
|
7 |
+
labels = ['Acidicus_Serpentine', 'Acronix_Vermillion', 'Akita_Never-Realm inhabitants', 'Antonia_Recurring allies', 'Ash_Elemental Masters', 'Aspheera_Pyro Vipers', 'Bansha_Ghosts', 'Benthomaar_Merlopians', 'Blunck_Vermillion', 'Bolobo_Elemental Masters', 'Bucko_Sky Pirates', 'Captain Soto_Citizens of Ninjago City', 'Chamille_Elemental Masters', 'Char_Pyro Vipers', 'Chew Toy_Dragon Hunters', 'Chief Mammatus_The Island inhabitants', 'Chope_Anacondrai Cultists', 'Clancee_Sky Pirates', 'Clouse_Anacondrai Cultists', 'Clutch Powers_Recurring allies', 'Cole_Main Characters', 'Cyren_Sky Pirates', 'Cyrus Borg_Recurring allies', 'Daddy No Legs_Dragon Hunters', 'Dareth_Recurring allies', 'Dogshank_Sky Pirates', 'Doubloon_Sky Pirates', 'Dr. Julien_Family members', 'Edna Walker_Family members', 'Ed Walker_Family members', 'Eyezor_Anacondrai Cultists', 'Faith_Dragon Hunters', 'Fangtom_Serpentine', 'Flintlocke_Sky Pirates', 'Fred Finely_Citizens of Ninjago City', 'Fuchsia Ninja_New Ninja', 'Fugi-Dove_Citizens of Ninjago City', 'General Arcturus_Serpentine', 'General Cryptor_Nindroids', 'General Kozu_Stone Army', 'General Vex_Never-Realm inhabitants', 'Ghoultar_Ghosts', 'Gleck_Shintaro Kingdom inhabitants', 'Glutinous_Merlopians', 'Gravis _Elemental Masters', 'Griffin Turner_Elemental Masters', 'Hounddog McBrag_Citizens of Ninjago City', 'Jacob Pevsner_Elemental Masters', 'Jay_Main Characters', 'Jet Jack_Dragon Hunters', 'Kai_Main Characters', 'Kapau_Anacondrai Cultists', 'Karlof_Elemental Masters', 'Khanjikhan_Sky Pirates', 'Killow_Sons of Garmadon', 'King Trimaar_Merlopians', 'King Vangelis_The Skull Sorcerer_Shintaro Kingdom inhabitants', 'Kruncha_Skulkin', 'Krux_Vermillion', 'lables.txt', 'Lloyd Garmadon_Main Characters', 'Lord Garmadon_Main Characters', 'Luke Cunningham_Sons of Garmadon', 'Machia_Vermillion', 'Master Chen_Anacondrai Cultists', 'Master Wu_Main Characters', 'Maya_Family members', 'Milton Dyer_Prime Empire inhabitants', 'Min-Droid_Nindroids', 'Misako_Family members', 'Mistaké_Recurring allies', 'Mister F_Council of the Crystal King', 'Monkey Wretch_Sky Pirates', 'Morro_Ghosts', 'Mr. E_Sons of Garmadon', 'Murt_Shintaro Kingdom inhabitants', 'Muzzle_Dragon Hunters', 'Nadakhan_Sky Pirates', 'Nelson_Recurring allies', 'Neuro_Elemental Masters', 'Nuckal_Skulkin', 'Nya_Main Characters', 'Officer Toque_Recurring allies', 'Okino_Prime Empire inhabitants', 'Orange Ninja_New Ninja', 'Paleman_Elemental Masters', 'Patty Keys_Citizens of Ninjago City', 'Pink Ninja_New Ninja', 'P.I.X.A.L._Main Characters', 'Police Commissioner_Recurring allies', 'Postman_Citizens of Ninjago City', 'Prince Kalmaar_Merlopians', 'Princess Harumi_Sons of Garmadon', 'Princess Vania_Shintaro Kingdom inhabitants', 'Pythor P. Chumsworth_Serpentine', 'Raggmunk_Vermillion', 'Ray_Family members', 'Ronin_Recurring allies', 'Rufus MacAllister_Citizens of Ninjago City', 'Samukai_Skulkin', 'Scott_Prime Empire inhabitants', 'Sensei_Master Kodokuna Yang_Ghosts', 'Shade_Elemental Masters', 'Skales_Serpentine', 'Skalidor_Serpentine', 'Skylor Chen_Elemental Masters', 'Slithraa_Serpentine', 'Soul Archer_Ghosts', 'Squiffy_Sky Pirates', 'Sushimi_Prime Empire inhabitants', 'The First Spinjitzu Master_Family members', 'The Great Devourer_Serpentine', 'The Ice Emperor_Never-Realm inhabitants', 'The Iron Baron_Dragon Hunters', 'The Mechanic_Prime Empire inhabitants', 'The Omega_Oni', 'The Overlord_Stone Army', 'The Preeminent_Ghosts', 'Timothy "Twitchy Tim" Batterson_The Island inhabitants', 'Tox_Elemental Masters', 'Ultra Violet_Sons of Garmadon', 'Unagami_Prime Empire inhabitants', 'Wrayth_Ghosts', 'Wyplash_Skulkin', 'Zane_Main Characters', 'Zugu_Anacondrai Cultists']
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
def predict(img):
|
13 |
+
img = PILImage.create(img)
|
14 |
+
pred, pred_idx, probs = learn.predict(img)
|
15 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
16 |
+
|
17 |
+
|
18 |
+
title = "Ninjago Character Classifier"
|
19 |
+
description = "Guesses the name of the Ninjago characters. Created from the fastai demo for Gradio and HuggingFace Spaces."
|
20 |
+
#article = "<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>Blog post</a></p>"
|
21 |
+
examples = ['Lloyd.jpg', 'Cole.png']
|
22 |
+
interpretation = 'default'
|
23 |
+
enable_queue = True
|
24 |
+
|
25 |
+
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(192, 192)), outputs=gr.outputs.Label(num_top_classes=3), title=title,
|
26 |
+
description=description, examples=examples, interpretation=interpretation, enable_queue=enable_queue).launch()
|
export_ninjago_classifier.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b4d78ea52c1297901033abd563d9fbfc808fd4fb08e3894a01edf59a931804d7
|
3 |
+
size 87772321
|
labels.txt
ADDED
@@ -0,0 +1,126 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Acidicus_Serpentine
|
2 |
+
Acronix_Vermillion
|
3 |
+
Akita_Never-Realm inhabitants
|
4 |
+
Antonia_Recurring allies
|
5 |
+
Ash_Elemental Masters
|
6 |
+
Aspheera_Pyro Vipers
|
7 |
+
Bansha_Ghosts
|
8 |
+
Benthomaar_Merlopians
|
9 |
+
Blunck_Vermillion
|
10 |
+
Bolobo_Elemental Masters
|
11 |
+
Bucko_Sky Pirates
|
12 |
+
Captain Soto_Citizens of Ninjago City
|
13 |
+
Chamille_Elemental Masters
|
14 |
+
Char_Pyro Vipers
|
15 |
+
Chew Toy_Dragon Hunters
|
16 |
+
Chief Mammatus_The Island inhabitants
|
17 |
+
Chope_Anacondrai Cultists
|
18 |
+
Clancee_Sky Pirates
|
19 |
+
Clouse_Anacondrai Cultists
|
20 |
+
Clutch Powers_Recurring allies
|
21 |
+
Cole_Main Characters
|
22 |
+
Cyren_Sky Pirates
|
23 |
+
Cyrus Borg_Recurring allies
|
24 |
+
Daddy No Legs_Dragon Hunters
|
25 |
+
Dareth_Recurring allies
|
26 |
+
Dogshank_Sky Pirates
|
27 |
+
Doubloon_Sky Pirates
|
28 |
+
Dr. Julien_Family members
|
29 |
+
Edna Walker_Family members
|
30 |
+
Ed Walker_Family members
|
31 |
+
Eyezor_Anacondrai Cultists
|
32 |
+
Faith_Dragon Hunters
|
33 |
+
Fangtom_Serpentine
|
34 |
+
Flintlocke_Sky Pirates
|
35 |
+
Fred Finely_Citizens of Ninjago City
|
36 |
+
Fuchsia Ninja_New Ninja
|
37 |
+
Fugi-Dove_Citizens of Ninjago City
|
38 |
+
General Arcturus_Serpentine
|
39 |
+
General Cryptor_Nindroids
|
40 |
+
General Kozu_Stone Army
|
41 |
+
General Vex_Never-Realm inhabitants
|
42 |
+
Ghoultar_Ghosts
|
43 |
+
Gleck_Shintaro Kingdom inhabitants
|
44 |
+
Glutinous_Merlopians
|
45 |
+
Gravis _Elemental Masters
|
46 |
+
Griffin Turner_Elemental Masters
|
47 |
+
Hounddog McBrag_Citizens of Ninjago City
|
48 |
+
Jacob Pevsner_Elemental Masters
|
49 |
+
Jay_Main Characters
|
50 |
+
Jet Jack_Dragon Hunters
|
51 |
+
Kai_Main Characters
|
52 |
+
Kapau_Anacondrai Cultists
|
53 |
+
Karlof_Elemental Masters
|
54 |
+
Khanjikhan_Sky Pirates
|
55 |
+
Killow_Sons of Garmadon
|
56 |
+
King Trimaar_Merlopians
|
57 |
+
King Vangelis_The Skull Sorcerer_Shintaro Kingdom inhabitants
|
58 |
+
Kruncha_Skulkin
|
59 |
+
Krux_Vermillion
|
60 |
+
lables.txt
|
61 |
+
Lloyd Garmadon_Main Characters
|
62 |
+
Lord Garmadon_Main Characters
|
63 |
+
Luke Cunningham_Sons of Garmadon
|
64 |
+
Machia_Vermillion
|
65 |
+
Master Chen_Anacondrai Cultists
|
66 |
+
Master Wu_Main Characters
|
67 |
+
Maya_Family members
|
68 |
+
Milton Dyer_Prime Empire inhabitants
|
69 |
+
Min-Droid_Nindroids
|
70 |
+
Misako_Family members
|
71 |
+
Mistaké_Recurring allies
|
72 |
+
Mister F_Council of the Crystal King
|
73 |
+
Monkey Wretch_Sky Pirates
|
74 |
+
Morro_Ghosts
|
75 |
+
Mr. E_Sons of Garmadon
|
76 |
+
Murt_Shintaro Kingdom inhabitants
|
77 |
+
Muzzle_Dragon Hunters
|
78 |
+
Nadakhan_Sky Pirates
|
79 |
+
Nelson_Recurring allies
|
80 |
+
Neuro_Elemental Masters
|
81 |
+
Nuckal_Skulkin
|
82 |
+
Nya_Main Characters
|
83 |
+
Officer Toque_Recurring allies
|
84 |
+
Okino_Prime Empire inhabitants
|
85 |
+
Orange Ninja_New Ninja
|
86 |
+
Paleman_Elemental Masters
|
87 |
+
Patty Keys_Citizens of Ninjago City
|
88 |
+
Pink Ninja_New Ninja
|
89 |
+
P.I.X.A.L._Main Characters
|
90 |
+
Police Commissioner_Recurring allies
|
91 |
+
Postman_Citizens of Ninjago City
|
92 |
+
Prince Kalmaar_Merlopians
|
93 |
+
Princess Harumi_Sons of Garmadon
|
94 |
+
Princess Vania_Shintaro Kingdom inhabitants
|
95 |
+
Pythor P. Chumsworth_Serpentine
|
96 |
+
Raggmunk_Vermillion
|
97 |
+
Ray_Family members
|
98 |
+
Ronin_Recurring allies
|
99 |
+
Rufus MacAllister_Citizens of Ninjago City
|
100 |
+
Samukai_Skulkin
|
101 |
+
Scott_Prime Empire inhabitants
|
102 |
+
Sensei_Master Kodokuna Yang_Ghosts
|
103 |
+
Shade_Elemental Masters
|
104 |
+
Skales_Serpentine
|
105 |
+
Skalidor_Serpentine
|
106 |
+
Skylor Chen_Elemental Masters
|
107 |
+
Slithraa_Serpentine
|
108 |
+
Soul Archer_Ghosts
|
109 |
+
Squiffy_Sky Pirates
|
110 |
+
Sushimi_Prime Empire inhabitants
|
111 |
+
The First Spinjitzu Master_Family members
|
112 |
+
The Great Devourer_Serpentine
|
113 |
+
The Ice Emperor_Never-Realm inhabitants
|
114 |
+
The Iron Baron_Dragon Hunters
|
115 |
+
The Mechanic_Prime Empire inhabitants
|
116 |
+
The Omega_Oni
|
117 |
+
The Overlord_Stone Army
|
118 |
+
The Preeminent_Ghosts
|
119 |
+
Timothy "Twitchy Tim" Batterson_The Island inhabitants
|
120 |
+
Tox_Elemental Masters
|
121 |
+
Ultra Violet_Sons of Garmadon
|
122 |
+
Unagami_Prime Empire inhabitants
|
123 |
+
Wrayth_Ghosts
|
124 |
+
Wyplash_Skulkin
|
125 |
+
Zane_Main Characters
|
126 |
+
Zugu_Anacondrai Cultists
|