Spaces:
Runtime error
Runtime error
initial commit
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Cell
|
2 |
+
from fastai.vision.all import *
|
3 |
+
import gradio as gr
|
4 |
+
|
5 |
+
# Cell
|
6 |
+
learn = load_learner('/kaggle/input/kitchen-detector-model/model.pkl')
|
7 |
+
|
8 |
+
# Cell
|
9 |
+
categories = ('kitchen', 'not_kitchen')
|
10 |
+
|
11 |
+
def classify_image(img):
|
12 |
+
pred,idx,probs = learn.predict(img)
|
13 |
+
return dict(zip(categories, map(float,probs)))
|
14 |
+
|
15 |
+
# Cell
|
16 |
+
image = gr.inputs.Image(shape=(192, 192))
|
17 |
+
label = gr.outputs.Label()
|
18 |
+
examples = ['/kaggle/input/kitchen-data-set/kitchen-data-set/kitchen/209154559.jpeg', '/kaggle/input/kitchen-data-set/kitchen-data-set/not_kitchen/209154922.jpeg']
|
19 |
+
|
20 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
21 |
+
intf.launch(inline=False)
|
model.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9315d05a1c6fb6deb69852e21361e47cc6e52d8f65d9d368396d1d13540330d1
|
3 |
+
size 46955929
|