Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,11 +10,11 @@ import random
|
|
10 |
def sample_digit(digit):
|
11 |
rn = 0
|
12 |
# pick a random digit from 60,000 in the training set until a desired match is found
|
13 |
-
while(train_labels[rn] !=
|
14 |
rn = int(random.random() * 60000)
|
15 |
-
|
16 |
fig = plt.figure()
|
17 |
-
plt.imshow(
|
18 |
out_txt = "train_images[%d] = %d" % (rn, train_labels[rn])
|
19 |
return fig, out_txt
|
20 |
|
@@ -25,7 +25,7 @@ iface = gr.Interface(
|
|
25 |
#gr.inputs.Number()
|
26 |
gr.inputs.Slider(0, 9)
|
27 |
],
|
28 |
-
outputs=[
|
29 |
title='MNIST Digit Sampler',
|
30 |
description='Pick a random digit from the MNIST dataset'
|
31 |
)
|
|
|
10 |
def sample_digit(digit):
|
11 |
rn = 0
|
12 |
# pick a random digit from 60,000 in the training set until a desired match is found
|
13 |
+
while(train_labels[rn] != digit):
|
14 |
rn = int(random.random() * 60000)
|
15 |
+
digit_img = train_images[rn]
|
16 |
fig = plt.figure()
|
17 |
+
plt.imshow(digit_img, cmap=plt.cm.binary)
|
18 |
out_txt = "train_images[%d] = %d" % (rn, train_labels[rn])
|
19 |
return fig, out_txt
|
20 |
|
|
|
25 |
#gr.inputs.Number()
|
26 |
gr.inputs.Slider(0, 9)
|
27 |
],
|
28 |
+
outputs=['image', 'text'],
|
29 |
title='MNIST Digit Sampler',
|
30 |
description='Pick a random digit from the MNIST dataset'
|
31 |
)
|