RogerKoala commited on
Commit
a8d302e
·
1 Parent(s): e795e6a

Add application file

Browse files
.gitattributes CHANGED
@@ -32,4 +32,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
32
  *.xz filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
 
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
32
  *.xz filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *.keras filter=lfs diff=lfs merge=lfs -text
36
  *tfevents* filter=lfs diff=lfs merge=lfs -text
Pokemons.txt ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Abra
2
+ Aerodactyl
3
+ Alakazam
4
+ Arbok
5
+ Arcanine
6
+ Articuno
7
+ Beedrill
8
+ Bellsprout
9
+ Blastoise
10
+ Bulbasaur
11
+ Butterfree
12
+ Caterpie
13
+ Chansey
14
+ Charizard
15
+ Charmander
16
+ Charmeleon
17
+ Clefable
18
+ Clefairy
19
+ Cloyster
20
+ Cubone
21
+ Dewgong
22
+ Diglett
23
+ Ditto
24
+ Dodrio
25
+ Doduo
26
+ Dragonair
27
+ Dragonite
28
+ Dratini
29
+ Drowzee
30
+ Dugtrio
31
+ Eevee
32
+ Ekans
33
+ Electabuzz
34
+ Electrode
35
+ Exeggcute
36
+ Exeggutor
37
+ Farfetch
38
+ Fearow
39
+ Flareon
40
+ Gastly
41
+ Gengar
42
+ Geodude
43
+ Gloom
44
+ Golbat
45
+ Goldeen
46
+ Golduck
47
+ Golem
48
+ Graveler
49
+ Grimer
50
+ Growlithe
51
+ Gyarados
52
+ Haunter
53
+ Hitmonchan
54
+ Hitmonlee
55
+ Horsea
56
+ Hypno
57
+ Ivysaur
58
+ Jigglypuff
59
+ Jolteon
60
+ Jynx
61
+ Kabuto
62
+ Kabutops
63
+ Kadabra
64
+ Kakuna
65
+ Kangaskhan
66
+ Kingler
67
+ Koffing
68
+ Krabby
69
+ Lapras
70
+ Lickitung
71
+ Machamp
72
+ Machoke
73
+ Machop
74
+ Magikarp
75
+ Magmar
76
+ Magnemite
77
+ Magneton
78
+ Mankey
79
+ Marowak
80
+ Meowth
81
+ Metapod
82
+ Mew
83
+ Mewtwo
84
+ Moltres
85
+ Mr-Mime
86
+ Muk
87
+ Nidoking
88
+ Nidoqueen
89
+ Nidoran♀
90
+ Nidoran♂
91
+ Nidorina
92
+ Nidorino
93
+ Ninetales
94
+ Oddish
95
+ Omanyte
96
+ Omastar
97
+ Onix
98
+ Paras
99
+ Parasect
100
+ Persian
101
+ Pidgeot
102
+ Pidgeotto
103
+ Pidgey
104
+ Pikachu
105
+ Pinsir
106
+ Poliwag
107
+ Poliwhirl
108
+ Poliwrath
109
+ Ponyta
110
+ Porygon
111
+ Primeape
112
+ Psyduck
113
+ Raichu
114
+ Rapidash
115
+ Raticate
116
+ Rattata
117
+ Rhydon
118
+ Rhyhorn
119
+ Sandshrew
120
+ Sandslash
121
+ Scyther
122
+ Seadra
123
+ Seaking
124
+ Seel
125
+ Shellder
126
+ Slowbro
127
+ Slowpoke
128
+ Snorlax
129
+ Spearow
130
+ Squirtle
131
+ Starmie
132
+ Staryu
133
+ Tangela
134
+ Tauros
135
+ Tentacool
136
+ Tentacruel
137
+ Vaporeon
138
+ Venomoth
139
+ Venonat
140
+ Venusaur
141
+ Victreebel
142
+ Vileplume
143
+ Voltorb
144
+ Vulpix
145
+ Wartortle
146
+ Weedle
147
+ Weepinbell
148
+ Weezing
149
+ Wigglytuff
150
+ Zapdos
151
+ Zubat
README.md CHANGED
@@ -1,12 +1,11 @@
1
  ---
2
  title: Pokedex
3
- emoji: 🌖
4
- colorFrom: purple
5
  colorTo: gray
6
  sdk: gradio
7
  sdk_version: 5.25.2
8
  app_file: app.py
9
  pinned: false
 
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
  title: Pokedex
3
+ emoji:
4
+ colorFrom: red
5
  colorTo: gray
6
  sdk: gradio
7
  sdk_version: 5.25.2
8
  app_file: app.py
9
  pinned: false
10
+ short_description: Pokémon first gen classifier
11
  ---
 
 
app.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import keras
3
+ from keras.src.applications.densenet import preprocess_input
4
+ import numpy as np
5
+
6
+ pokedex = keras.saving.load_model("pokedex.keras")
7
+
8
+ with open('Pokemons.txt', 'r') as f:
9
+ class_labels = f.read().splitlines()
10
+
11
+
12
+ def classify_pokemon(image):
13
+
14
+ img = image.resize((224, 224))
15
+
16
+ x = keras.utils.img_to_array(img)
17
+ x = np.expand_dims(x, axis=0)
18
+ x = preprocess_input(x)
19
+
20
+ preds = pokedex.predict(x)
21
+
22
+ top_indices = preds[0].argsort()[-3:][::-1]
23
+
24
+ results = {class_labels[i]: float(preds[0][i]) for i in top_indices}
25
+ return results
26
+
27
+
28
+ title = "Pokedex"
29
+ description = "Pokémon first gen classifier"
30
+
31
+ examples = [
32
+ 'examples/Pikachu.png',
33
+ 'examples/Charmander.png',
34
+ 'examples/Squirtle.png',
35
+ 'examples/Bulbasaur.png',
36
+ 'examples/Caterpie.png',
37
+ 'examples/Cloyster.png',
38
+ 'examples/Gengar.png',
39
+ 'examples/Porygon.png',
40
+ 'examples/Rapidash.png',
41
+ 'examples/Slowpoke.png',
42
+ ]
43
+ intf = gr.Interface(
44
+ fn=classify_pokemon,
45
+ inputs=gr.Image(type='pil', label="Upload a Pokémon image"),
46
+ outputs=gr.Label(num_top_classes=3, label="Prediction"),
47
+ examples=examples,
48
+ title=title,
49
+ description=description,
50
+ )
51
+
52
+ intf.launch(inline=False)
examples/Bulbasaur.png ADDED
examples/Caterpie.png ADDED
examples/Charmander.png ADDED
examples/Cloyster.png ADDED
examples/Gengar.png ADDED
examples/Pikachu.png ADDED
examples/Porygon.png ADDED
examples/Rapidash.png ADDED
examples/Slowpoke.png ADDED
examples/Squirtle.png ADDED
pokedex.keras ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e5f5e771e137c6b5803a751140f5a545e9e9cf542a01a2d7475e73937ed31be4
3
+ size 87375811
requirements.txt ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ absl-py==2.2.2
2
+ aiofiles==24.1.0
3
+ annotated-types==0.7.0
4
+ anyio==4.9.0
5
+ astunparse==1.6.3
6
+ certifi==2025.1.31
7
+ charset-normalizer==3.4.1
8
+ click==8.1.8
9
+ colorama==0.4.6
10
+ exceptiongroup==1.2.2
11
+ fastapi==0.115.12
12
+ ffmpy==0.5.0
13
+ filelock==3.18.0
14
+ flatbuffers==25.2.10
15
+ fsspec==2025.3.2
16
+ gast==0.6.0
17
+ google-pasta==0.2.0
18
+ gradio==5.25.2
19
+ gradio_client==1.8.0
20
+ groovy==0.1.2
21
+ grpcio==1.71.0
22
+ h11==0.14.0
23
+ h5py==3.13.0
24
+ httpcore==1.0.8
25
+ httpx==0.28.1
26
+ huggingface-hub==0.30.2
27
+ idna==3.10
28
+ Jinja2==3.1.6
29
+ keras==3.9.2
30
+ libclang==18.1.1
31
+ Markdown==3.8
32
+ markdown-it-py==3.0.0
33
+ MarkupSafe==3.0.2
34
+ mdurl==0.1.2
35
+ ml_dtypes==0.5.1
36
+ namex==0.0.8
37
+ numpy==2.1.3
38
+ opt_einsum==3.4.0
39
+ optree==0.15.0
40
+ orjson==3.10.16
41
+ packaging==24.2
42
+ pandas==2.2.3
43
+ pillow==11.2.1
44
+ protobuf==5.29.4
45
+ pydantic==2.11.3
46
+ pydantic_core==2.33.1
47
+ pydub==0.25.1
48
+ Pygments==2.19.1
49
+ python-dateutil==2.9.0.post0
50
+ python-multipart==0.0.20
51
+ pytz==2025.2
52
+ PyYAML==6.0.2
53
+ requests==2.32.3
54
+ rich==14.0.0
55
+ ruff==0.11.5
56
+ safehttpx==0.1.6
57
+ semantic-version==2.10.0
58
+ shellingham==1.5.4
59
+ six==1.17.0
60
+ sniffio==1.3.1
61
+ starlette==0.46.2
62
+ tensorboard==2.19.0
63
+ tensorboard-data-server==0.7.2
64
+ tensorflow==2.19.0
65
+ tensorflow-io-gcs-filesystem==0.31.0
66
+ termcolor==3.0.1
67
+ tomlkit==0.13.2
68
+ tqdm==4.67.1
69
+ typer==0.15.2
70
+ typing-inspection==0.4.0
71
+ typing_extensions==4.13.2
72
+ tzdata==2025.2
73
+ urllib3==2.4.0
74
+ uvicorn==0.34.1
75
+ websockets==15.0.1
76
+ Werkzeug==3.1.3
77
+ wrapt==1.17.2