Daniel K.Gunleiksrud
commited on
Commit
•
ee2159b
1
Parent(s):
ec9056d
init
Browse files- app.py +17 -0
- images/0.PNG +0 -0
- images/1.PNG +0 -0
- images/2.PNG +0 -0
- images/3.PNG +0 -0
- images/4.PNG +0 -0
- images/5.PNG +0 -0
- images/6.PNG +0 -0
- images/7.PNG +0 -0
- images/8.PNG +0 -0
- images/9.PNG +0 -0
- model.pkl +3 -0
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from fastai.vision.all import *
|
3 |
+
|
4 |
+
learn = load_learner('model.pkl')
|
5 |
+
|
6 |
+
categories = ('Flower','Sunflower')
|
7 |
+
|
8 |
+
def classify(img):
|
9 |
+
pred,_,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 = ['images/0.png','images/1.png','images/2.png','images/3.png','images/4.png','images/5.png','images/6.png','images/7.png','images/8.png','images/9.png']
|
15 |
+
|
16 |
+
iface = gr.Interface(fn=classify, inputs=image, outputs=label, examples=examples)
|
17 |
+
iface.launch()
|
images/0.PNG
ADDED
images/1.PNG
ADDED
images/2.PNG
ADDED
images/3.PNG
ADDED
images/4.PNG
ADDED
images/5.PNG
ADDED
images/6.PNG
ADDED
images/7.PNG
ADDED
images/8.PNG
ADDED
images/9.PNG
ADDED
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:324e57b74bf0eec3c1f9c1cf30d0d403d06ea39aa0ae69c7305934a287be47e3
|
3 |
+
size 46955887
|