Spaces:
Runtime error
Runtime error
yvoievid
commited on
Commit
·
1ac2987
1
Parent(s):
b804560
fix formatting
Browse files- .app.py.swp +0 -0
- app.py +8 -8
.app.py.swp
ADDED
Binary file (12.3 kB). View file
|
|
app.py
CHANGED
@@ -7,16 +7,16 @@ learn = load_learner('model.pkl')
|
|
7 |
|
8 |
labels = learn.dls.vocab
|
9 |
def predict(img):
|
10 |
-
|
11 |
pred,pred_idx,probs = learn.predict(img)
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
|
21 |
gr.Interface(fn=predict,
|
22 |
inputs=gr.inputs.Image(shape=(512, 512)),
|
|
|
7 |
|
8 |
labels = learn.dls.vocab
|
9 |
def predict(img):
|
10 |
+
img = PILImage.create(img)
|
11 |
pred,pred_idx,probs = learn.predict(img)
|
12 |
+
return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
13 |
|
14 |
+
title = "Horde or Aliance Classifier"
|
15 |
+
description = "Horde or Aliance Classifier created in Hugging Face Spaces"
|
16 |
+
article="<p style='text-align: center'><a href='https://tmabraham.github.io/blog/gradio_hf_spaces_tutorial' target='_blank'>Blog post</a></p>"
|
17 |
+
examples = ['horde.jpeg', 'alliance.jpeg']
|
18 |
+
interpretation='default'
|
19 |
+
enable_queue=True
|
20 |
|
21 |
gr.Interface(fn=predict,
|
22 |
inputs=gr.inputs.Image(shape=(512, 512)),
|