Spaces:
Build error
Build error
update app.py
Browse files
app.py
CHANGED
|
@@ -49,13 +49,18 @@ with gr.Blocks(css=".gradio-container {background:lightyellow;color:red;}", titl
|
|
| 49 |
gr.HTML('<div style="font-size:12pt; text-align:center; color:yellow;"MNIST 分類器</div>')
|
| 50 |
|
| 51 |
with gr.Row():
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
output_label=gr.Label(label="予測確率", num_top_classes=5)
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
|
| 60 |
# demo.queue(concurrency_count=3)
|
| 61 |
demo.launch()
|
|
|
|
| 49 |
gr.HTML('<div style="font-size:12pt; text-align:center; color:yellow;"MNIST 分類器</div>')
|
| 50 |
|
| 51 |
with gr.Row():
|
| 52 |
+
with gr.Tab("キャンバス"):
|
| 53 |
+
input_image1 = gr.Image(label="画像入力", source="canvas", type="pil", image_mode="L", shape=(28,28), invert_colors=True)
|
| 54 |
+
send_btn1 = gr.Button("予測する")
|
| 55 |
+
|
| 56 |
+
with gr.Tab("画像ファイル"):
|
| 57 |
+
input_image2 = gr.Image(label="画像入力", type="pil", image_mode="L", shape=(28, 28), invert_colors=True)
|
| 58 |
+
send_btn2 = gr.Button("予測する")
|
| 59 |
|
| 60 |
output_label=gr.Label(label="予測確率", num_top_classes=5)
|
| 61 |
|
| 62 |
+
send_btn1.click(fn=predict, inputs=input_image1, outputs=output_label)
|
| 63 |
+
send_btn2.click(fn=predict, inputs=input_image2, outputs=output_label)
|
| 64 |
|
| 65 |
# demo.queue(concurrency_count=3)
|
| 66 |
demo.launch()
|