Spaces:
Runtime error
Runtime error
Bimurat Mukhtar commited on
Commit ·
a334ea8
1
Parent(s): fbcf0aa
refactoring
Browse files
app.py
CHANGED
|
@@ -4,9 +4,13 @@ from fastai.learner import *
|
|
| 4 |
|
| 5 |
learn = load_learner('model_upd.pkl')
|
| 6 |
labels = learn.dls.vocab
|
|
|
|
|
|
|
| 7 |
def predict(img):
|
| 8 |
img = PILImage.create(img)
|
| 9 |
-
pred,pred_idx,probs = learn.predict(img)
|
| 10 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
learn = load_learner('model_upd.pkl')
|
| 6 |
labels = learn.dls.vocab
|
| 7 |
+
|
| 8 |
+
|
| 9 |
def predict(img):
|
| 10 |
img = PILImage.create(img)
|
| 11 |
+
pred, pred_idx, probs = learn.predict(img)
|
| 12 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 13 |
|
| 14 |
+
|
| 15 |
+
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(
|
| 16 |
+
share=True)
|