Spaces:
Runtime error
Runtime error
Initial app
Browse filesAdd initial test version of app
- .gitattributes +1 -0
- app.py +20 -0
- kidby.jpg +0 -0
- kirby.jpg +0 -0
- model.pkl +3 -0
- simonetti.jpg +0 -0
.gitattributes
CHANGED
@@ -29,3 +29,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
29 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
30 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
31 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
32 |
+
model.pkl filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastbook import *
|
3 |
+
from fastai.vision.widgets import *
|
4 |
+
|
5 |
+
categories = ('Kidby', 'Kirby', 'Simonetti')
|
6 |
+
|
7 |
+
def classify_image(img):
|
8 |
+
pred, idx, probs = learn.predict(img)
|
9 |
+
return dict(zip(categories, map(float, probs)))
|
10 |
+
|
11 |
+
class PILImageRGBA(PILImage): _show_args,_open_args = {'cmap':'Viridis'},{'mode': 'RGB'} # Used for loading RGBA input images
|
12 |
+
|
13 |
+
learn = load_learner('model.pkl')
|
14 |
+
|
15 |
+
image = gr.inputs.Image(shape=(192,192))
|
16 |
+
label = gr.outputs.Label()
|
17 |
+
examples = ['kidby.jpg', 'kirby.jpg', 'simonetti.jpg']
|
18 |
+
|
19 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
20 |
+
intf.launch(inline=False)
|
kidby.jpg
ADDED
kirby.jpg
ADDED
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2da21e1ee06717a9c2272b29d6468a7edcf60b8cda6190c07de61d2b3f632e68
|
3 |
+
size 102886297
|
simonetti.jpg
ADDED