Spaces:
Runtime error
Runtime error
Commit
·
1a862da
1
Parent(s):
f194c4c
Added the model, examples, and requirements
Browse files- app.py +17 -0
- lotad.jpg +0 -0
- model_v4_98_percent_final.pkl +3 -0
- quagsire.jpg +0 -0
- requirements.txt +2 -0
- slowpoke.jpg +0 -0
- snorlax.jpg +0 -0
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
learn = load_learner('model_v4_98_percent_final.pkl')
|
5 |
+
|
6 |
+
categories = ('lotad', 'quagsire', 'slowpoke', 'snorlax')
|
7 |
+
|
8 |
+
def classify_image(img):
|
9 |
+
pred, idx, probs = learn.predict(img)
|
10 |
+
return dict(zip(categories, map(float, probs)))
|
11 |
+
|
12 |
+
image = gr.inputs.Image(shape=(192, 192))
|
13 |
+
label = gr.outputs.Label()
|
14 |
+
examples = ['lotad.jpg', 'quagsire.jpg', 'slowpoke.jpg', 'snorlax.jpg']
|
15 |
+
|
16 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
17 |
+
intf.launch()
|
lotad.jpg
ADDED
![]() |
model_v4_98_percent_final.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ae3dd67364a7a22cd182b3ca021e5c10eb82bdc5d2943b0c88c0986aa4799852
|
3 |
+
size 87484773
|
quagsire.jpg
ADDED
![]() |
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
fastai
|
2 |
+
gradio
|
slowpoke.jpg
ADDED
![]() |
snorlax.jpg
ADDED
![]() |