Spaces:
Sleeping
Sleeping
run the model
Browse files- .gitignore +2 -0
- app.py +24 -4
- kj/303/270kken.jpg +0 -0
- soverom.jpg +0 -0
.gitignore
CHANGED
@@ -1 +1,3 @@
|
|
1 |
.idea
|
|
|
|
|
|
1 |
.idea
|
2 |
+
.venv
|
3 |
+
model.pkl
|
app.py
CHANGED
@@ -1,7 +1,27 @@
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
def greet(name):
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
__all__ = ['learn', 'classify_image', 'categories', 'image', 'label', 'examples', 'intf']
|
2 |
+
|
3 |
+
# Cell
|
4 |
+
from fastai.vision.all import *
|
5 |
import gradio as gr
|
6 |
|
|
|
|
|
7 |
|
8 |
+
# Cell
|
9 |
+
learn = load_learner('model.pkl')
|
10 |
+
|
11 |
+
# Cell
|
12 |
+
categories = (
|
13 |
+
'bad', 'balkong', 'hage', 'info', 'kjeller', 'kjøkken', 'kontor', 'loft', 'parkering', 'plantegning', 'soverom', 'stue',
|
14 |
+
'umøblert', 'utsikt', 'vaskerom')
|
15 |
+
|
16 |
+
def classify_image(img):
|
17 |
+
pred,idx,probs = learn.predict(img)
|
18 |
+
return dict(zip(categories, map(float,probs)))
|
19 |
+
|
20 |
+
# Cell
|
21 |
+
image = gr.inputs.Image(shape=(192, 192))
|
22 |
+
label = gr.outputs.Label()
|
23 |
+
examples = ['kjøkken.jpg', 'soverom.jpg']
|
24 |
+
|
25 |
+
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
26 |
+
intf.launch(inline=False)
|
27 |
+
|
kj/303/270kken.jpg
ADDED
![]() |
soverom.jpg
ADDED
![]() |