Spaces:
Runtime error
Runtime error
Upload 5 files
Browse files- app.py +16 -0
- elliptical.jpg +0 -0
- irregular.jpg +0 -0
- model.pkl +3 -0
- spiral.jpg +0 -0
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import *
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
|
5 |
+
learn = load_learner('model.pkl')
|
6 |
+
|
7 |
+
categories = 'elliptical', 'irregular', 'spiral'
|
8 |
+
def classify_img(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 = ['elliptical.jpg', 'irregular.jpg', 'spiral.jpg']
|
15 |
+
iface = gr.Interface(fn = classify_img, inputs = image, outputs = label, examples = examples)
|
16 |
+
iface.launch()
|
elliptical.jpg
ADDED
irregular.jpg
ADDED
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:75f30f2d925d6df8b5527468273f3fa2ee9af4e132247905704ea9445aff0ceb
|
3 |
+
size 46961733
|
spiral.jpg
ADDED