Spaces:
Runtime error
Runtime error
Commit
·
921cfb8
1
Parent(s):
bcbf01d
updated app.py
Browse files
app.py
CHANGED
@@ -4,17 +4,21 @@ import skimage
|
|
4 |
|
5 |
learn = load_learner('movements_05_02_22_4pm.pkl')
|
6 |
|
|
|
7 |
def predict(img):
|
8 |
-
labels = learn.dls.vocab
|
9 |
img = PILImage.create(img)
|
10 |
pred,pred_idx,probs = learn.predict(img)
|
11 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
12 |
|
13 |
examples = [f"Image{n:02d}.jpg" for n in range(20)]
|
|
|
|
|
|
|
14 |
|
15 |
gr.Interface(fn=predict,
|
16 |
inputs=gr.inputs.Image(shape=((512,512))),
|
17 |
outputs=gr.outputs.Label(num_top_classes=5),
|
18 |
-
title =
|
19 |
examples = examples,
|
20 |
-
|
|
|
|
4 |
|
5 |
learn = load_learner('movements_05_02_22_4pm.pkl')
|
6 |
|
7 |
+
labels = learn.dls.vocab
|
8 |
def predict(img):
|
|
|
9 |
img = PILImage.create(img)
|
10 |
pred,pred_idx,probs = learn.predict(img)
|
11 |
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
12 |
|
13 |
examples = [f"Image{n:02d}.jpg" for n in range(20)]
|
14 |
+
interpretation='default'
|
15 |
+
title = "Art Movement Classifier"
|
16 |
+
description = "What Art Movement Matches the Image Best? Expressionism | Impressionism | Hudson River School | Ukiyo-e | Pre-Raphaelite"
|
17 |
|
18 |
gr.Interface(fn=predict,
|
19 |
inputs=gr.inputs.Image(shape=((512,512))),
|
20 |
outputs=gr.outputs.Label(num_top_classes=5),
|
21 |
+
title = title,
|
22 |
examples = examples,
|
23 |
+
interpretation = interpretation,
|
24 |
+
description = description).launch(share=True, enable_queue=True)
|