Spaces:
Sleeping
Sleeping
updated gradio image initialization
Browse files
app.py
CHANGED
@@ -3,20 +3,20 @@
|
|
3 |
# %% auto 0
|
4 |
__all__ = ['learn', 'image', 'label', 'examples', 'intf', 'classify_image']
|
5 |
|
6 |
-
# %% ../app.ipynb
|
7 |
from fastai.vision.all import *
|
8 |
import gradio as gr
|
9 |
|
10 |
-
# %% ../app.ipynb
|
11 |
learn = load_learner('export.pkl')
|
12 |
|
13 |
-
# %% ../app.ipynb
|
14 |
def classify_image(img):
|
15 |
pred,pred_idx,probs = learn.predict(img)
|
16 |
return dict(zip(learn.dls.vocab, map(float, probs)))
|
17 |
|
18 |
-
# %% ../app.ipynb
|
19 |
-
image = gr.components.Image(
|
20 |
label = gr.components.Label()
|
21 |
examples = ['cat.jpg', 'dog.jpg']
|
22 |
|
|
|
3 |
# %% auto 0
|
4 |
__all__ = ['learn', 'image', 'label', 'examples', 'intf', 'classify_image']
|
5 |
|
6 |
+
# %% ../app.ipynb 3
|
7 |
from fastai.vision.all import *
|
8 |
import gradio as gr
|
9 |
|
10 |
+
# %% ../app.ipynb 7
|
11 |
learn = load_learner('export.pkl')
|
12 |
|
13 |
+
# %% ../app.ipynb 13
|
14 |
def classify_image(img):
|
15 |
pred,pred_idx,probs = learn.predict(img)
|
16 |
return dict(zip(learn.dls.vocab, map(float, probs)))
|
17 |
|
18 |
+
# %% ../app.ipynb 18
|
19 |
+
image = gr.components.Image(height=192, width=192)
|
20 |
label = gr.components.Label()
|
21 |
examples = ['cat.jpg', 'dog.jpg']
|
22 |
|