Spaces:
Runtime error
Runtime error
Malay Shah
commited on
Commit
•
4e25ce8
1
Parent(s):
457c8da
Fixed a bug in app.py
Browse files- app.py +5 -6
- export.pkl +3 -0
app.py
CHANGED
@@ -2,17 +2,16 @@ import gradio as gr
|
|
2 |
from fastai.vision.all import *
|
3 |
import skimage
|
4 |
|
5 |
-
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=2)).launch(share=True)
|
6 |
-
|
7 |
-
learn = load_learning('export.pkl')
|
8 |
-
|
9 |
-
labels = learn.dls.vocab
|
10 |
-
|
11 |
def predict(img):
|
12 |
img = PILImage.create(img)
|
13 |
pred, pred_idx, probs = learn.predict(img)
|
14 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
15 |
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
|
18 |
|
|
|
2 |
from fastai.vision.all import *
|
3 |
import skimage
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
def predict(img):
|
6 |
img = PILImage.create(img)
|
7 |
pred, pred_idx, probs = learn.predict(img)
|
8 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
9 |
|
10 |
+
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=2)).launch(share=True)
|
11 |
+
|
12 |
+
learn = load_learning('export.pkl')
|
13 |
+
|
14 |
+
labels = learn.dls.vocab
|
15 |
|
16 |
|
17 |
|
export.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:239e7a62dfbac7b3309b88c0b6b1a1d0423cf3e952e300178335924370bc169a
|
3 |
+
size 46965665
|