Update app.py
Browse files
app.py
CHANGED
|
@@ -72,25 +72,17 @@ output = [gr.Label(), gr.Plot()]
|
|
| 72 |
# output = [gr.Plot()]
|
| 73 |
# it's good practice to pass examples, description and a title to guide users
|
| 74 |
title = 'Bag of Image Classification'
|
| 75 |
-
description = 'This is the demo for Keras Implementation of Classification using Attention-based Deep Multiple Instance Learning (MIL). The model will try to predict whether number 8 is within the set of input images. As it was trained on MNIST dataset, please use MNIST image for precise result.'
|
|
|
|
|
|
|
| 76 |
|
| 77 |
gr_interface = gr.Interface(
|
| 78 |
infer, inputs=[input1, input2, input3], outputs=output, allow_flagging='never',
|
| 79 |
-
analytics_enabled=False, title=title, description=description,
|
| 80 |
# examples = [[f'{i}.png' for i in range(0,3)], [f'{i}.png' for i in range(3,6)], [f'{i}.png' for i in range(6,9)], '9.png']
|
| 81 |
examples = [['samples/0.png', 'samples/6.png', 'samples/2.png'], ['samples/1.png','samples/2.png', 'samples/3.png'],
|
| 82 |
['samples/4.png', 'samples/8.png', 'samples/7.png'], ['samples/8.png', 'samples/0.png', 'samples/9.png'],
|
| 83 |
['samples/5.png', 'samples/6.png', 'samples/3.png'], ['samples/7.png', 'samples/8.png', 'samples/9.png']]
|
| 84 |
)
|
| 85 |
-
|
| 86 |
-
with gr.Row():
|
| 87 |
-
gr.Markdown(
|
| 88 |
-
"""
|
| 89 |
-
<h4>Credits</h4>
|
| 90 |
-
Author: <a href="https://huggingface.co/geninhu"> Nhu Hoang</a>.<br>
|
| 91 |
-
Based on the following Keras example <a href="https://keras.io/examples/vision/attention_mil_classification/"> Classification using Attention-based Deep Multiple Instance Learning (MIL)</a> by <a href=\"https://www.linkedin.com/in/mohamadjaber1\">Mohamad Jaber.</a> <br>
|
| 92 |
-
Check out the model <a href="https://huggingface.co/keras-io/attention_mil">here</a>
|
| 93 |
-
"""
|
| 94 |
-
)
|
| 95 |
|
| 96 |
gr_interface.launch(enable_queue=True, debug=False)
|
|
|
|
| 72 |
# output = [gr.Plot()]
|
| 73 |
# it's good practice to pass examples, description and a title to guide users
|
| 74 |
title = 'Bag of Image Classification'
|
| 75 |
+
description = 'This is the demo for Keras Implementation of Classification using Attention-based Deep Multiple Instance Learning (MIL). The model will try to predict whether number 8 is within the set of input images. As it was trained on MNIST dataset, please use MNIST image for precise result.'
|
| 76 |
+
|
| 77 |
+
article = "Author: <a href=\"https://huggingface.co/geninhu\">Nhu Hoang</a>. Based on the following Keras example <a href="https://keras.io/examples/vision/attention_mil_classification/"> Classification using Attention-based Deep Multiple Instance Learning (MIL)</a> by <a href=\"https://www.linkedin.com/in/mohamadjaber1\">Mohamad Jaber.</a> <br> Check out the model <a href="https://huggingface.co/keras-io/attention_mil">here</a>"
|
| 78 |
|
| 79 |
gr_interface = gr.Interface(
|
| 80 |
infer, inputs=[input1, input2, input3], outputs=output, allow_flagging='never',
|
| 81 |
+
analytics_enabled=False, title=title, description=description, article=article,
|
| 82 |
# examples = [[f'{i}.png' for i in range(0,3)], [f'{i}.png' for i in range(3,6)], [f'{i}.png' for i in range(6,9)], '9.png']
|
| 83 |
examples = [['samples/0.png', 'samples/6.png', 'samples/2.png'], ['samples/1.png','samples/2.png', 'samples/3.png'],
|
| 84 |
['samples/4.png', 'samples/8.png', 'samples/7.png'], ['samples/8.png', 'samples/0.png', 'samples/9.png'],
|
| 85 |
['samples/5.png', 'samples/6.png', 'samples/3.png'], ['samples/7.png', 'samples/8.png', 'samples/9.png']]
|
| 86 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
gr_interface.launch(enable_queue=True, debug=False)
|