ClassCat commited on
Commit
eb78931
β€’
1 Parent(s): cf1cd33

update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -39,6 +39,12 @@ model.eval()
39
  import gradio as gr
40
  from torchvision import transforms
41
 
 
 
 
 
 
 
42
  def predict(image):
43
  tsr_image = transforms.ToTensor()(image)
44
 
@@ -62,7 +68,9 @@ with gr.Blocks(css=".gradio-container {background:honeydew;}", title="MNIST εˆ†
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
 
 
39
  import gradio as gr
40
  from torchvision import transforms
41
 
42
+ import os
43
+ import glob
44
+
45
+ examples_dir = './examples'
46
+ example_files = glob.glob(os.path.join(examples_dir, '*.png'))
47
+
48
  def predict(image):
49
  tsr_image = transforms.ToTensor()(image)
50
 
 
68
  with gr.Tab("画像フゑむル"):
69
  input_image2 = gr.Image(label="画像ε…₯εŠ›", type="pil", image_mode="L", shape=(28, 28), invert_colors=True)
70
  send_btn2 = gr.Button("ζŽ¨θ«–γ™γ‚‹")
71
+
72
+ gr.Examples(example_files, inputs=input_image2)
73
+ #gr.Examples(['examples/sample02.png', 'examples/sample04.png'], inputs=input_image2)
74
 
75
  output_label=gr.Label(label="ζŽ¨θ«–η’ΊηŽ‡", num_top_classes=3)
76