Spaces:
Runtime error
Runtime error
Commit
·
015c506
1
Parent(s):
1e3d80a
Update app.py
Browse files
app.py
CHANGED
|
@@ -55,7 +55,13 @@ def fashion_MNIST_prediction(test_image, model='KNN'):
|
|
| 55 |
else:
|
| 56 |
return "Invalid Model Selection"
|
| 57 |
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
input_image = gr.inputs.Image(shape=(28, 28), image_mode='L')
|
| 60 |
input_model = gr.inputs.Dropdown(['KNN', 'DecisionTreeClassifier', 'RandomForestClassifier', 'AdaBoostClassifier', 'GradientBoostingClassifier'])
|
| 61 |
|
|
@@ -63,6 +69,6 @@ output_label = gr.outputs.Textbox(label="Predicted Label")
|
|
| 63 |
output_probability = gr.outputs.Label(num_top_classes=10, label="Predicted Probability Per Class")
|
| 64 |
|
| 65 |
gr.Interface(fn=fashion_MNIST_prediction,
|
| 66 |
-
inputs=[input_image, input_model],
|
| 67 |
outputs=[output_label, output_probability],
|
| 68 |
title="Fashion MNIST classification").launch(debug=True)
|
|
|
|
| 55 |
else:
|
| 56 |
return "Invalid Model Selection"
|
| 57 |
|
| 58 |
+
# Add example images and labels
|
| 59 |
+
examples = [
|
| 60 |
+
['Tshirt.png', 'T-shirt/top'],
|
| 61 |
+
['Trouser.png', 'Trouser'],
|
| 62 |
+
['Pullover.png', 'Pullover'],
|
| 63 |
+
['Dress.png', 'Dress'],
|
| 64 |
+
|
| 65 |
input_image = gr.inputs.Image(shape=(28, 28), image_mode='L')
|
| 66 |
input_model = gr.inputs.Dropdown(['KNN', 'DecisionTreeClassifier', 'RandomForestClassifier', 'AdaBoostClassifier', 'GradientBoostingClassifier'])
|
| 67 |
|
|
|
|
| 69 |
output_probability = gr.outputs.Label(num_top_classes=10, label="Predicted Probability Per Class")
|
| 70 |
|
| 71 |
gr.Interface(fn=fashion_MNIST_prediction,
|
| 72 |
+
inputs=[input_image, input_model,examples],
|
| 73 |
outputs=[output_label, output_probability],
|
| 74 |
title="Fashion MNIST classification").launch(debug=True)
|