reduce py imports
Browse files
app.py
CHANGED
@@ -1,17 +1,7 @@
|
|
1 |
# AUTOGENERATED! DO NOT EDIT! File to edit: ../pokemonclassifier.ipynb.
|
2 |
|
3 |
# %% auto 0
|
4 |
-
__all__ = ['
|
5 |
-
'intf', 'classify_image']
|
6 |
-
|
7 |
-
# %% ../pokemonclassifier.ipynb 3
|
8 |
-
from fastai.vision.all import *
|
9 |
-
|
10 |
-
modelname = 'model.pkl'
|
11 |
-
|
12 |
-
pokemon_types = pd.read_csv("pokemongen1patch.csv", nrows=20)
|
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
|
@@ -19,6 +9,7 @@ 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
|
@@ -35,7 +26,7 @@ def classify_image(img):
|
|
35 |
|
36 |
image = gr.inputs.Image(shape=(192,192))
|
37 |
label = gr.outputs.Label()
|
38 |
-
examples = [
|
39 |
|
40 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
41 |
intf.launch(inline=False)
|
|
|
1 |
# AUTOGENERATED! DO NOT EDIT! File to edit: ../pokemonclassifier.ipynb.
|
2 |
|
3 |
# %% auto 0
|
4 |
+
__all__ = ['learn_inf', 'imagespath', 'image', 'label', 'examples', 'intf', 'classify_image']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
# %% ../pokemonclassifier.ipynb 24
|
7 |
from huggingface_hub import hf_hub_download
|
|
|
9 |
|
10 |
learn_inf = load_learner(hf_hub_download("Okkoman/PokeFace", modelname))
|
11 |
learn_inf.dls.vocab
|
12 |
+
imagespath = ''
|
13 |
|
14 |
# %% ../pokemonclassifier.ipynb 28
|
15 |
import gradio as gr
|
|
|
26 |
|
27 |
image = gr.inputs.Image(shape=(192,192))
|
28 |
label = gr.outputs.Label()
|
29 |
+
examples = [f"{imagespath}pikachu.webp", f"{imagespath}bulbizarre.jpg", f"{imagespath}tortank.png"]
|
30 |
|
31 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
32 |
intf.launch(inline=False)
|