wrap the zip object in a dict
Browse files
app.py
CHANGED
|
@@ -5,7 +5,7 @@ categories = ('black', 'grizzly', 'teddy')
|
|
| 5 |
|
| 6 |
def classify_image(img):
|
| 7 |
pred, idx, probs = learn.predict(img)
|
| 8 |
-
return zip(categories, map(float, probs))
|
| 9 |
|
| 10 |
def greet(name):
|
| 11 |
return "Hello " + name + "!!"
|
|
@@ -15,9 +15,9 @@ learn = load_learner('model/bears.pkl')
|
|
| 15 |
image = gr.inputs.Image(shape=(192, 192))
|
| 16 |
label = gr.outputs.Label()
|
| 17 |
examples = ['images/black.jpg', 'images/grizzly.jpg', 'images/teddy.jpg']
|
| 18 |
-
|
| 19 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 20 |
intf.launch(inline=False)
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
ps
|
|
|
|
|
|
| 5 |
|
| 6 |
def classify_image(img):
|
| 7 |
pred, idx, probs = learn.predict(img)
|
| 8 |
+
return dict(zip(categories, map(float, probs)))
|
| 9 |
|
| 10 |
def greet(name):
|
| 11 |
return "Hello " + name + "!!"
|
|
|
|
| 15 |
image = gr.inputs.Image(shape=(192, 192))
|
| 16 |
label = gr.outputs.Label()
|
| 17 |
examples = ['images/black.jpg', 'images/grizzly.jpg', 'images/teddy.jpg']
|
|
|
|
| 18 |
intf = gr.Interface(fn=classify_image, inputs=image, outputs=label, examples=examples)
|
| 19 |
intf.launch(inline=False)
|
| 20 |
+
|
| 21 |
+
# m = learn.model
|
| 22 |
+
# ps = list(m.parameters())
|
| 23 |
+
# ps[1]
|