Spaces:
Sleeping
Sleeping
update app.py
Browse files
app.py
CHANGED
@@ -50,21 +50,21 @@ def predict(image):
|
|
50 |
return confidences
|
51 |
|
52 |
|
53 |
-
with gr.Blocks(css=".gradio-container {background:honeydew;}", title="MNIST
|
54 |
) as demo:
|
55 |
gr.HTML("""<div style="font-family:'Times New Roman', 'Serif'; font-size:16pt; font-weight:bold; text-align:center; color:royalblue;">MNIST ει‘ε¨</div>""")
|
56 |
|
57 |
with gr.Row():
|
58 |
-
with gr.Tab("
|
59 |
-
input_image1 = gr.Image(
|
60 |
-
send_btn1 = gr.Button("
|
61 |
|
62 |
-
with gr.Tab("
|
63 |
input_image2 = gr.Image(label="η»εε
₯ε", type="pil", image_mode="L", shape=(28, 28), invert_colors=True)
|
64 |
-
send_btn2 = gr.Button("
|
65 |
gr.Examples(['examples/sample02.png', 'examples/sample04.png'], inputs=input_image2)
|
66 |
|
67 |
-
output_label=gr.Label(label="
|
68 |
|
69 |
send_btn1.click(fn=predict, inputs=input_image1, outputs=output_label)
|
70 |
send_btn2.click(fn=predict, inputs=input_image2, outputs=output_label)
|
|
|
50 |
return confidences
|
51 |
|
52 |
|
53 |
+
with gr.Blocks(css=".gradio-container {background:honeydew;}", title="MNIST Classification"
|
54 |
) as demo:
|
55 |
gr.HTML("""<div style="font-family:'Times New Roman', 'Serif'; font-size:16pt; font-weight:bold; text-align:center; color:royalblue;">MNIST ει‘ε¨</div>""")
|
56 |
|
57 |
with gr.Row():
|
58 |
+
with gr.Tab("Canvas"):
|
59 |
+
input_image1 = gr.Image(source="canvas", type="pil", image_mode="L", shape=(28,28), invert_colors=True)
|
60 |
+
send_btn1 = gr.Button("Infer")
|
61 |
|
62 |
+
with gr.Tab("Image file"):
|
63 |
input_image2 = gr.Image(label="η»εε
₯ε", type="pil", image_mode="L", shape=(28, 28), invert_colors=True)
|
64 |
+
send_btn2 = gr.Button("Infer")
|
65 |
gr.Examples(['examples/sample02.png', 'examples/sample04.png'], inputs=input_image2)
|
66 |
|
67 |
+
output_label=gr.Label(label="Probabilities", num_top_classes=3)
|
68 |
|
69 |
send_btn1.click(fn=predict, inputs=input_image1, outputs=output_label)
|
70 |
send_btn2.click(fn=predict, inputs=input_image2, outputs=output_label)
|