Spaces:
Sleeping
Sleeping
update app.py
Browse files
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,8 @@ with gr.Blocks(css=".gradio-container {background:honeydew;}", title="MNIST Clas
|
|
62 |
with gr.Tab("Image file"):
|
63 |
input_image2 = gr.Image(type="pil", image_mode="L", shape=(28, 28), invert_colors=True)
|
64 |
send_btn2 = gr.Button("Infer")
|
65 |
-
gr.Examples(
|
|
|
66 |
|
67 |
output_label=gr.Label(label="Probabilities", 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("Image file"):
|
69 |
input_image2 = gr.Image(type="pil", image_mode="L", shape=(28, 28), invert_colors=True)
|
70 |
send_btn2 = gr.Button("Infer")
|
71 |
+
gr.Examples(example_files, inputs=input_image2)
|
72 |
+
#gr.Examples(['examples/sample02.png', 'examples/sample04.png'], inputs=input_image2)
|
73 |
|
74 |
output_label=gr.Label(label="Probabilities", num_top_classes=3)
|
75 |
|