Spaces:
Sleeping
Sleeping
toheedakhtar
commited on
Commit
·
b937508
1
Parent(s):
5a3f9c7
working good now
Browse files- app.py +7 -9
- model.pkl → mommodel.pkl +2 -2
app.py
CHANGED
@@ -9,21 +9,19 @@ def label_func(x):
|
|
9 |
else:
|
10 |
return 'Mogged'
|
11 |
|
12 |
-
learn = load_learner('
|
13 |
|
14 |
-
|
15 |
|
16 |
def classify_img(image):
|
17 |
-
what, _t , _ = learn.predict(image)
|
18 |
-
return what
|
19 |
-
|
20 |
-
|
21 |
|
22 |
-
image = gr.Image()
|
23 |
label = gr.Label()
|
24 |
examples = ['001.jpg', '002.jpg', '007.jpg', '008.jpg']
|
25 |
|
26 |
-
|
27 |
-
|
28 |
intf = gr.Interface(fn=classify_img, inputs=image, outputs=label, examples=examples)
|
29 |
intf.launch(inline=False)
|
|
|
9 |
else:
|
10 |
return 'Mogged'
|
11 |
|
12 |
+
learn = load_learner('mommodel.pkl')
|
13 |
|
14 |
+
categories = {'Mogger', 'Mogged'}
|
15 |
|
16 |
def classify_img(image):
|
17 |
+
# what, _t , _ = learn.predict(image)
|
18 |
+
# return what
|
19 |
+
pred, idx, probs = learn.predict(image)
|
20 |
+
return dict(zip(categories, map(float, probs)))
|
21 |
|
22 |
+
image = gr.Image(shape=(224,224))
|
23 |
label = gr.Label()
|
24 |
examples = ['001.jpg', '002.jpg', '007.jpg', '008.jpg']
|
25 |
|
|
|
|
|
26 |
intf = gr.Interface(fn=classify_img, inputs=image, outputs=label, examples=examples)
|
27 |
intf.launch(inline=False)
|
model.pkl → mommodel.pkl
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:830f8b69a882cf030ae81d67e45cf66ab7040a4e0a79fc7b4aa5fe6d1d665704
|
3 |
+
size 46962605
|