use hf_hub_download to find the model
Browse files
app.py
CHANGED
@@ -1,6 +1,10 @@
|
|
1 |
-
|
2 |
-
'examples', 'intf', 'classify_image']
|
3 |
|
|
|
|
|
|
|
|
|
|
|
4 |
from fastai.vision.all import *
|
5 |
|
6 |
modelname = 'model.pkl'
|
@@ -9,10 +13,14 @@ 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 |
-
|
13 |
-
|
|
|
|
|
|
|
14 |
learn_inf.dls.vocab
|
15 |
|
|
|
16 |
import gradio as gr
|
17 |
|
18 |
def classify_image(img):
|
@@ -27,7 +35,7 @@ def classify_image(img):
|
|
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)
|
|
|
1 |
+
# AUTOGENERATED! DO NOT EDIT! File to edit: ../pokemonclassifier.ipynb.
|
|
|
2 |
|
3 |
+
# %% auto 0
|
4 |
+
__all__ = ['modelname', 'pokemon_types', 'pokemon_types_en', 'pokemon_types_fr', 'learn_inf', 'image', 'label', 'examples',
|
5 |
+
'intf', 'classify_image']
|
6 |
+
|
7 |
+
# %% ../pokemonclassifier.ipynb 3
|
8 |
from fastai.vision.all import *
|
9 |
|
10 |
modelname = 'model.pkl'
|
|
|
13 |
pokemon_types_en = pokemon_types['en']
|
14 |
pokemon_types_fr = pokemon_types['fr']
|
15 |
|
16 |
+
# %% ../pokemonclassifier.ipynb 24
|
17 |
+
from huggingface_hub import hf_hub_download
|
18 |
+
from fastai.learner import load_learner
|
19 |
+
|
20 |
+
learn_inf = load_learner(hf_hub_download("Okkoman/PokeFace", modelname))
|
21 |
learn_inf.dls.vocab
|
22 |
|
23 |
+
# %% ../pokemonclassifier.ipynb 28
|
24 |
import gradio as gr
|
25 |
|
26 |
def classify_image(img):
|
|
|
35 |
|
36 |
image = gr.inputs.Image(shape=(192,192))
|
37 |
label = gr.outputs.Label()
|
38 |
+
examples = ['images/pikachu.webp', 'images/bulbizarre.jpg', 'images/tortank.png']
|
39 |
|
40 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
41 |
intf.launch(inline=False)
|