Add application files
Browse files- README.md +2 -0
- app.py +33 -0
- bulbizarre.jpg +0 -0
- pikachu.webp +0 -0
- pokemongen1patch.csv +154 -0
- tortank.png +0 -0
README.md
CHANGED
@@ -8,6 +8,8 @@ sdk_version: 3.45.2
|
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
|
|
|
|
11 |
---
|
12 |
|
13 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
license: mit
|
11 |
+
models:
|
12 |
+
- Okkoman/PokeFace
|
13 |
---
|
14 |
|
15 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
__all__ = ['modelname', 'pokemon_types', 'pokemon_types_en', 'pokemon_types_fr', 'path', 'learn_inf', 'image', 'label',
|
2 |
+
'examples', 'intf', 'classify_image']
|
3 |
+
|
4 |
+
from fastai.vision.all import *
|
5 |
+
|
6 |
+
modelname = 'model.pkl'
|
7 |
+
|
8 |
+
pokemon_types = pd.read_csv("pokemongen1patch.csv", nrows=20)
|
9 |
+
pokemon_types_en = pokemon_types['en']
|
10 |
+
pokemon_types_fr = pokemon_types['fr']
|
11 |
+
|
12 |
+
path = Path()
|
13 |
+
learn_inf = load_learner(path/modelname)
|
14 |
+
learn_inf.dls.vocab
|
15 |
+
|
16 |
+
import gradio as gr
|
17 |
+
|
18 |
+
def classify_image(img):
|
19 |
+
prob_threshold = 0.8
|
20 |
+
pred,pred_idx,probs = learn_inf.predict(img)
|
21 |
+
index = pokemon_types_en[pokemon_types_en == pred].index[0]
|
22 |
+
pred_fr = pokemon_types_fr.iloc[index]
|
23 |
+
if probs[pred_idx] > prob_threshold:
|
24 |
+
return f"{pred}(en) - {pred_fr}(fr) - {probs[pred_idx]*100:.0f}%"
|
25 |
+
else:
|
26 |
+
return 'unknown'
|
27 |
+
|
28 |
+
image = gr.inputs.Image(shape=(192,192))
|
29 |
+
label = gr.outputs.Label()
|
30 |
+
examples = ['pikachu.webp', 'bulbizarre.jpg', 'tortank.png']
|
31 |
+
|
32 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
33 |
+
intf.launch(inline=False)
|
bulbizarre.jpg
ADDED
![]() |
pikachu.webp
ADDED
![]() |
pokemongen1patch.csv
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
en,fr,jp,num,type1,type2
|
2 |
+
Bulbasaur,Bulbizarre,フシギダネ,001,Grass,Poison
|
3 |
+
Ivysaur,Herbizarre,フシギソウ,002,Grass,Poison
|
4 |
+
Venusaur,Florizarre,フシギバナ,003,Grass,Poison
|
5 |
+
Charmander,Salamèche,ヒトカゲ,004,Fire,
|
6 |
+
Charmeleon,Reptincel,リザード,005,Fire,
|
7 |
+
Charizard,Dracaufeu,リザードン,006,Fire,Flying
|
8 |
+
Squirtle,Carapuce,ゼニガメ,007,Water,
|
9 |
+
Wartortle,Carabaffe,カメール,008,Water,
|
10 |
+
Blastoise,Tortank,カメックス,009,Water,
|
11 |
+
Caterpie,Chenipan,キャタピー,010,Bug,
|
12 |
+
Metapod,Chrysacier,トランセル,011,Bug,
|
13 |
+
Butterfree,Papilusion,バタフリー,012,Bug,Flying
|
14 |
+
Weedle,Aspicot,ビードル,013,Bug,Poison
|
15 |
+
Kakuna,Coconfort,コクーン,014,Bug,Poison
|
16 |
+
Beedrill,Dardargnan,スピアー,015,Bug,Poison
|
17 |
+
Pidgey,Roucool,ポッポ,016,Normal,Flying
|
18 |
+
Pidgeotto,Roucoups,ピジョン,017,Normal,Flying
|
19 |
+
Pidgeot,Roucarnage,ピジョット,018,Normal,Flying
|
20 |
+
Rattata,Rattata,コラッタ,019,Normal,
|
21 |
+
Raticate,Rattatac,ラッタ,020,Normal,
|
22 |
+
Spearow,Piafabec,オニスズメ,021,Normal,Flying
|
23 |
+
Fearow,Rapasdepic,オニドリル,022,Normal,Flying
|
24 |
+
Ekans,Abo,アーボ,023,Poison,
|
25 |
+
Arbok,Arbok,アーボック,024,Poison,
|
26 |
+
Pikachu,Pikachu,ピカチュウ,025,Electric,
|
27 |
+
Raichu,Raichu,ライチュウ,026,Electric,
|
28 |
+
Sandshrew,Sabelette,サンド,027,Ground,
|
29 |
+
Sandslash,Sablaireau,サンドパン,028,Ground,
|
30 |
+
Nidoran♀,Nidoran♀,ニドラン♀,029,Poison,
|
31 |
+
Nidorina,Nidorina,ニドリーナ,030,Poison,
|
32 |
+
Nidoqueen,Nidoqueen,ニドクイン,031,Poison,Ground
|
33 |
+
Nidoran♂,Nidoran♂,ニドラン♂,032,Poison,
|
34 |
+
Nidorino,Nidorino,ニドリーノ,033,Poison,
|
35 |
+
Nidoking,Nidoking,ニドキング,034,Poison,Ground
|
36 |
+
Clefairy,Mélofée,ピッピ,035,Fairy,
|
37 |
+
Clefable,Mélodelfe,ピクシー,036,Fairy,
|
38 |
+
Vulpix,Goupix,ロコン,037,Fire,
|
39 |
+
Ninetales,Feunard,キュウコン,038,Fire,
|
40 |
+
Jigglypuff,Rondoudou,プリン,039,Normal,Fairy
|
41 |
+
Wigglytuff,Grodoudou,プクリン,040,Normal,Fairy
|
42 |
+
Zubat,Nosferapti,ズバット,041,Poison,Flying
|
43 |
+
Golbat,Nosferalto,ゴルバット,042,Poison,Flying
|
44 |
+
Oddish,Mystherbe,ナゾノクサ,043,Grass,Poison
|
45 |
+
Gloom,Ortide,クサイハナ,044,Grass,Poison
|
46 |
+
Vileplume,Rafflesia,ラフレシア,045,Grass,Poison
|
47 |
+
Paras,Paras,パラス,046,Bug,Grass
|
48 |
+
Parasect,Parasect,パラセクト,047,Bug,Grass
|
49 |
+
Venonat,Mimitoss,コンパン,048,Bug,Poison
|
50 |
+
Venomoth,Aéromite,モルフォン,049,Bug,Poison
|
51 |
+
Digglet,Taupiqueur,ディグダ,050,Ground,
|
52 |
+
Dugtrio,Triopikeur,ダグトリオ,051,Ground,
|
53 |
+
Meowth,Miaouss,ニャース,052,Normal,
|
54 |
+
Persian,Persian,ペルシアン,053,Normal,
|
55 |
+
Psyduck,Psykokwak,コダック,054,Water,
|
56 |
+
Golduck,Akwakwak,ゴルダック,055,Water,
|
57 |
+
Mankey,Férosinge,マンキー,056,Fighting,
|
58 |
+
Primeape,Colossinge,オコリザル,057,Fighting,
|
59 |
+
Growlithe,Caninos,ガーディ,058,Fire,
|
60 |
+
Arcanine,Arcanin,ウインディ,059,Fire,
|
61 |
+
Poliwag,Ptitard,ニョロモ,060,Water,
|
62 |
+
Poliwhirl,Têtarte,ニョロゾ,061,Water,
|
63 |
+
Poliwrath,Tartard,ニョロボン,062,Water,Fighting
|
64 |
+
Abra,Abra,ケーシィ,063,Psychic,
|
65 |
+
Kadabra,Kadabra,ユンゲラー,064,Psychic,
|
66 |
+
Alakazam,Alakazam,フーディン,065,Psychic,
|
67 |
+
Machop,Machoc,ワンリキ,066,Fighting,
|
68 |
+
Machoke,Machopeur,ゴーリキー,067,Fighting,
|
69 |
+
Machamp,Mackogneur,カイリキー,068,Fighting,
|
70 |
+
Bellsprout,Chétiflor,マダツボミ,069,Grass,Poison
|
71 |
+
Weepinbell,Boustiflor,マダツホソウ,070,Grass,Poison
|
72 |
+
Victreebel,Empiflor,ウツドン,071,Grass,Poison
|
73 |
+
Tentacool,Tentacool,メノクラゲ,072,Water,Poison
|
74 |
+
Tentacruel,Tentacruel,ドククラゲ,073,Water,Poison
|
75 |
+
Geodude,Racaillou,イシツブテ,074,Rock,Ground
|
76 |
+
Graveler,Gravalanch,ゴローン,075,Rock,Ground
|
77 |
+
Golem,Grolem,ゴローニャ,076,Rock,Ground
|
78 |
+
Ponyta,Galopa,ポニータ,077,Fire,
|
79 |
+
Rapidash,Galopa,ギャロップ,078,Fire,
|
80 |
+
Slowpoke,Ramoloss,ヤドン,079,Water,Psychic
|
81 |
+
Slowbro,Flagadoss,ヤドラン,080,Water,Psychic
|
82 |
+
Magnemite,Magnéti,コイル,081,Electric,Steel
|
83 |
+
Magneton,Magnéton,レアコイル,082,Electric,Steel
|
84 |
+
Farfetch'd,Canarticho,カモネギ,083,Normal,Flying
|
85 |
+
Doduo,Doduo,ドードー,084,Normal,Flying
|
86 |
+
Dodrio,Dodrio,ドードリオ,085,Normal,Flying
|
87 |
+
Seel,Otaria,パウワウ,086,Water,
|
88 |
+
Dewgong,Lamantine,ジュゴン,087,Water,Ice
|
89 |
+
Grimer,Tadmorv,ベトベター,088,Poison,
|
90 |
+
Muk,Grotadmorv,ベトベトン,089,Poison,
|
91 |
+
Shellder,Kokiyas,シェルダー,090,Water,
|
92 |
+
Cloyster,Crustabri,パルシェン,091,Water,Ice
|
93 |
+
Gastly,Fantominus,ゴース,092,Ghost,Poison
|
94 |
+
Haunter,Spectrum,ゴースト,093,Ghost,Poison
|
95 |
+
Gengar,Ectoplasma,ゲンガー,094,Ghost,Poison
|
96 |
+
Onix,Onix,イワーク,095,Rock,Ground
|
97 |
+
Drowzee,Soporifik,スリープ,096,Psychic,
|
98 |
+
Hypno,Hypnomade,スリーパー,097,Psychic,
|
99 |
+
Krabby,Krabby,クラブ,098,Water,
|
100 |
+
Kingler,Krabboss,キングラー,099,Water,
|
101 |
+
Voltorb,Voltorbe,ビリリダマ,100,Electric,
|
102 |
+
Electrode,Électrode,マルマイン,101,Electric,
|
103 |
+
Exeggcute,Noeunoeuf,タマタマ,102,Grass,Psychic
|
104 |
+
Exeggutor,Noadkoko,ナッシー,103,Grass,Psychic
|
105 |
+
Cubone,Osselait,カラカラ,104,Ground,
|
106 |
+
Marowak,Ossatueur,ガラガラ,105,Ground,
|
107 |
+
Hitmonlee,Kicklee,��ワムラー,106,Fighting,
|
108 |
+
Hitmonchan,Tygnon,エビワラー,107,Fighting,
|
109 |
+
Lickitung,Excelangue,ベロリンガ,108,Normal,
|
110 |
+
Koffing,Smogo,ドガース,109,Poison,
|
111 |
+
Weezing,Smogogo,マタドガス,110,Poison,
|
112 |
+
Rhyhorn,Rhinocorne,サイホーン,111,Ground,Rock
|
113 |
+
Rhydon,Rhinoféros,サイドン,112,Ground,Rock
|
114 |
+
Chansey,Leveinard,ラッキー,113,Normal,
|
115 |
+
Tangela,Saquedeneu,モンジャラ,114,Grass,
|
116 |
+
Kangaskhan,Kangourex,ガルーラ,115,Normal,
|
117 |
+
Horsea,Hypotrempe,タッツー,116,Water,
|
118 |
+
Seadra,Hypocéan,シードラ,117,Water,
|
119 |
+
Goldeen,Poissirène,トサキント,118,Water,
|
120 |
+
Seaking,Poissoroy,アズマオウ,119,Water,
|
121 |
+
Staryu,Stari,ヒトデマン,120,Water,
|
122 |
+
Starmie,Staross,スターミー,121,Water,Psychic
|
123 |
+
Mr. Mime,M. Mime,バリヤード,122,Psychic,Fairy
|
124 |
+
Scyther,Insecateur,ストライク,123,Bug,Flying
|
125 |
+
Jynx,Lippoutou,ルージュラ,124,Ice,Psychic
|
126 |
+
Electabuzz,Élektek,エレブー,125,Electric,
|
127 |
+
Magmar,Magmar,ブーバー,126,Fire,
|
128 |
+
Pinsir,Scarabrute,カイロス,127,Bug,
|
129 |
+
Tauros,Tauros,ケンタロス,128,Normal,
|
130 |
+
Magikarp,Magicarpe,コイキング,129,Water,
|
131 |
+
Gyarados,Léviator,ギャラドス,130,Water,Flying
|
132 |
+
Lapras,Lokhlass,ラプラス,131,Water,Ice
|
133 |
+
Ditto,Métamorph,メタモン,132,Normal,
|
134 |
+
Eevee,Évoli,イーブイ,133,Normal,
|
135 |
+
Vaporeon,Aquali,シャワーズ,134,Water,
|
136 |
+
Jolteon,Voltali,サンダース,135,Electric,
|
137 |
+
Flareon,Pyroli,ブースター,136,Fire,
|
138 |
+
Porygon,Porygon,ポリゴン,137,Normal,
|
139 |
+
Omanyte,Amonita,オムナイト,138,Rock,Water
|
140 |
+
Omastar,Amonistar,オムスター,139,Rock,Water
|
141 |
+
Kabuto,Kabuto,カブト,140,Rock,Water
|
142 |
+
Kabutops,Kabutops,カブトプス,141,Rock,Water
|
143 |
+
Aerodactyl,Ptéra,プテラ,142,Rock,Flying
|
144 |
+
Snorlax,Ronflex,カビゴン,143,Normal,
|
145 |
+
Articuno,Artikodin,フリーザー,144,Ice,Flying
|
146 |
+
Zapdos,Électhor,サンダー,145,Electric,Flying
|
147 |
+
Moltres,Sulfura,ファイヤー,146,Fire,Flying
|
148 |
+
Dratini,Minidraco,ミニリュウ,147,Dragon,
|
149 |
+
Dragonair,Draco,ハクリュー,148,Dragon,
|
150 |
+
Dragonite,Dracolosse,カイリュー,149,Dragon,Flying
|
151 |
+
Mewtwo,Mewtwo,ミュウツー,150,Psychic,
|
152 |
+
Mew,Mew,ミュウ,151,Psychic,
|
153 |
+
|
154 |
+
|
tortank.png
ADDED
![]() |