Spaces:
Runtime error
Runtime error
classification label with scores
Browse files
app.py
CHANGED
@@ -132,19 +132,15 @@ def predict(filepath):
|
|
132 |
input_tensor = tf.expand_dims(tensor, axis=0)
|
133 |
|
134 |
output = model.predict(input_tensor)
|
135 |
-
high_score = max(output[0])
|
136 |
|
137 |
-
|
138 |
|
139 |
-
return
|
140 |
|
141 |
demo = gr.Interface(
|
142 |
fn=predict,
|
143 |
inputs=gr.Image(label='photo', type='filepath'),
|
144 |
-
outputs=
|
145 |
-
gr.Label(label="Predicted breed"),
|
146 |
-
gr.Label(label="Accuracy score")
|
147 |
-
],
|
148 |
examples=[
|
149 |
'imgs/beethoven.jpg',
|
150 |
'imgs/belle.png',
|
|
|
132 |
input_tensor = tf.expand_dims(tensor, axis=0)
|
133 |
|
134 |
output = model.predict(input_tensor)
|
|
|
135 |
|
136 |
+
confidences = { dogs_breeds[i]: float(output[0][i]) for i in range(120) }
|
137 |
|
138 |
+
return confidences
|
139 |
|
140 |
demo = gr.Interface(
|
141 |
fn=predict,
|
142 |
inputs=gr.Image(label='photo', type='filepath'),
|
143 |
+
outputs=gr.Label(label="Predicted breed", num_top_classes=3),
|
|
|
|
|
|
|
144 |
examples=[
|
145 |
'imgs/beethoven.jpg',
|
146 |
'imgs/belle.png',
|