Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,8 +5,8 @@ learn = load_learner('export.pkl')
|
|
| 5 |
|
| 6 |
labels = learn.dls.vocab
|
| 7 |
def predict(img):
|
| 8 |
-
|
| 9 |
-
pred,pred_idx,probs = learn.predict(
|
| 10 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 11 |
|
| 12 |
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
|
|
|
|
| 5 |
|
| 6 |
labels = learn.dls.vocab
|
| 7 |
def predict(img):
|
| 8 |
+
Input_Image = PILImage.create(img)
|
| 9 |
+
pred,pred_idx,probs = learn.predict(Input_Image)
|
| 10 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
| 11 |
|
| 12 |
gr.Interface(fn=predict, inputs=gr.inputs.Image(shape=(512, 512)), outputs=gr.outputs.Label(num_top_classes=3)).launch(share=True)
|