Spaces:
Runtime error
Runtime error
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,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 |
-
|
|
|
|
|
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 |
|