Spaces:
Runtime error
Runtime error
Malay Shah
commited on
Commit
•
ac11a0b
1
Parent(s):
4b765d9
Fixed another bug in app.py
Browse files
app.py
CHANGED
@@ -2,16 +2,14 @@ import gradio as gr
|
|
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 |
-
|
11 |
-
learn = load_learning('export.pkl')
|
12 |
-
|
13 |
-
labels = learn.dls.vocab
|
14 |
-
|
15 |
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=2)).launch(share=True)
|
16 |
|
17 |
|
|
|
2 |
from fastai.vision.all import *
|
3 |
import skimage
|
4 |
|
5 |
+
learn = load_learner('export.pkl')
|
6 |
+
labels = learn.dls.vocab
|
7 |
+
|
8 |
def predict(img):
|
9 |
img = PILImage.create(img)
|
10 |
pred, pred_idx, probs = learn.predict(img)
|
11 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
12 |
|
|
|
|
|
|
|
|
|
|
|
13 |
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=2)).launch(share=True)
|
14 |
|
15 |
|