ClassCat commited on
Commit
345be36
Β·
1 Parent(s): 6dbbb44

update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
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(label="画像ε…₯εŠ›", source="canvas", type="pil", image_mode="L", shape=(28,28), invert_colors=True)
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="ζŽ¨θ«–η’ΊηŽ‡", 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)
 
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)