Spaces:
Sleeping
Sleeping
J commited on
Commit ·
c3c5160
1
Parent(s): 7eabf0c
updates to ui
Browse files
.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
model.pklZone.Identifier
|
| 2 |
+
tabby-cat-names-1467374954.jpgZone.Identifier
|
app.py
CHANGED
|
@@ -1,7 +1,19 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from fastai.vision.all import *
|
| 3 |
+
import PIL
|
| 4 |
|
| 5 |
+
learned = load_learner('model.pkl')
|
|
|
|
| 6 |
|
| 7 |
+
labels = learned.dls.vocab
|
| 8 |
+
|
| 9 |
+
def predict (img):
|
| 10 |
+
img = PILImage.create(img)
|
| 11 |
+
pred, pred_idx, probs = learned.predict(img)
|
| 12 |
+
return dict(zip(labels, map(float, probs)))
|
| 13 |
+
|
| 14 |
+
title = "Cat Predictor"
|
| 15 |
+
examples= ["tabby.jpg"]
|
| 16 |
+
|
| 17 |
+
iface = gr.Interface(fn=predict, title=title, examples=examples, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3))
|
| 18 |
+
|
| 19 |
+
iface.launch(debug=True)
|
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:693118bf2aedb896a9745dbeec1a65b2b61d02dd793418f21b7b8b9e9084ab70
|
| 3 |
+
size 47065195
|
tabby.jpg
ADDED
|