Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,20 +0,0 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from fastai.vision.all import *
|
3 |
-
import skimage
|
4 |
-
import pickle
|
5 |
-
|
6 |
-
learn = load_learner('CNN_SNACKDETECTOR_MODEL_2.pkl')
|
7 |
-
|
8 |
-
labels = learn.dls.vocab
|
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 |
-
title = "Dutch Snack Detector"
|
15 |
-
description = "Dutch Snack Detector: Detect your Dutch snack and enjoy"
|
16 |
-
examples = ['frikandel.jpg']
|
17 |
-
#interpretation='default'
|
18 |
-
enable_queue=True
|
19 |
-
|
20 |
-
gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(224, 224)),outputs=gr.outputs.Label(num_top_classes=3),title=title,description=description,article=article,examples=examples,interpretation=interpretation,enable_queue=enable_queue).launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|