Spaces:
Build error
Build error
msieczak commited on
Commit ·
c4ec89a
1
Parent(s): 6eced6f
Add application file
Browse files- app.py +11 -4
- hanzo.jpg +0 -0
- kiriko.jpg +0 -0
- model.pkl +3 -0
- winston.jpg +0 -0
app.py
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastai.vision.all import *
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
categories = ('D.va','Doomfist', 'Junker Queen', 'Orisa', 'Reinhardt', 'Roadhog', 'Sigma', 'Winston', 'Wrecking ball', 'Ashe', 'Bastion', 'Cassidy', 'Echo', 'Genji', 'Hanzo', 'Junkrat', 'Mei', 'Pharah', 'Soldier: 76', 'Sojourn', 'Sombra', 'Symmetra', 'Torbjorn', 'Tracer', 'Widowmaker', 'Ana', 'Baptiste', 'Brigitte', 'Kiriko', 'Lucio', 'Mercy', 'Moira', 'Zenyatta')
|
| 5 |
+
def classify_image(img):
|
| 6 |
+
pred,idx,probs = learn.predict(img)
|
| 7 |
+
return dict(zip(categories, map(float,probs)))
|
| 8 |
|
| 9 |
+
image = gr.inputs.Image(shape=(192, 192))
|
| 10 |
+
label = gr.outputs.Label()
|
| 11 |
+
examples = ['hanzo.jpg', 'kiriko.jpg', 'winston.jpg']
|
| 12 |
+
|
| 13 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 14 |
+
intf.launch(inline =False)
|
hanzo.jpg
ADDED
|
kiriko.jpg
ADDED
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b20069a9c1f429fa91af2e6fcea8193efdc36f4805ae2018e5d2d3064070d419
|
| 3 |
+
size 47029291
|
winston.jpg
ADDED
|