Spaces:
Runtime error
Runtime error
Commit
·
447cdd5
1
Parent(s):
157b5bc
removing deprecated stuff, adding back examples
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ title = "Open/Closed Door Classifier"
|
|
| 8 |
description = "A classifier trained using fastai on search images of open and closed doors." \
|
| 9 |
"Created for Lesson 2 in the fastai course."
|
| 10 |
|
| 11 |
-
|
| 12 |
|
| 13 |
examples = ["open-door.jpg",
|
| 14 |
"crack_2.jpg", "red_arch.jpg",
|
|
@@ -18,13 +18,9 @@ examples = ["open-door.jpg",
|
|
| 18 |
|
| 19 |
examples = list(
|
| 20 |
map(
|
| 21 |
-
lambda x:
|
| 22 |
-
os.path.join(
|
| 23 |
-
os.path.dirname(__file__),
|
| 24 |
-
"examples/" + x),
|
| 25 |
examples))
|
| 26 |
#print(examples)
|
| 27 |
-
'''
|
| 28 |
|
| 29 |
|
| 30 |
learn = load_learner('door_model.pkl')
|
|
@@ -38,10 +34,12 @@ def predict(img):
|
|
| 38 |
|
| 39 |
iface = gr.Interface(
|
| 40 |
fn=predict,
|
| 41 |
-
inputs=gr.
|
| 42 |
-
outputs=gr.
|
| 43 |
title=title,
|
| 44 |
description=description,
|
| 45 |
-
examples=
|
|
|
|
|
|
|
| 46 |
|
| 47 |
|
|
|
|
| 8 |
description = "A classifier trained using fastai on search images of open and closed doors." \
|
| 9 |
"Created for Lesson 2 in the fastai course."
|
| 10 |
|
| 11 |
+
|
| 12 |
|
| 13 |
examples = ["open-door.jpg",
|
| 14 |
"crack_2.jpg", "red_arch.jpg",
|
|
|
|
| 18 |
|
| 19 |
examples = list(
|
| 20 |
map(
|
| 21 |
+
lambda x: "examples/" + x,
|
|
|
|
|
|
|
|
|
|
| 22 |
examples))
|
| 23 |
#print(examples)
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
learn = load_learner('door_model.pkl')
|
|
|
|
| 34 |
|
| 35 |
iface = gr.Interface(
|
| 36 |
fn=predict,
|
| 37 |
+
inputs=gr.Image(shape=(224, 224)),
|
| 38 |
+
outputs=gr.Label(),
|
| 39 |
title=title,
|
| 40 |
description=description,
|
| 41 |
+
examples=examples)
|
| 42 |
+
|
| 43 |
+
iface.launch()
|
| 44 |
|
| 45 |
|