Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -9,12 +9,12 @@ import random
|
|
9 |
|
10 |
def pick_digit(digit_choice):
|
11 |
rn = 0
|
12 |
-
# pick a random digit from training set until a match is found
|
13 |
while(train_labels[rn] != digit_choice):
|
14 |
-
rn = int(random.random() *
|
15 |
digit = train_images[rn]
|
16 |
fig = plt.figure()
|
17 |
-
plt.imshow(digit)
|
18 |
out_txt = "train_images[%d] = %d" % (rn, train_labels[rn])
|
19 |
return fig, out_txt
|
20 |
|
|
|
9 |
|
10 |
def pick_digit(digit_choice):
|
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_choice):
|
14 |
+
rn = int(random.random() * 60000)
|
15 |
digit = train_images[rn]
|
16 |
fig = plt.figure()
|
17 |
+
plt.imshow(digit, cmap=plt.cm.binary)
|
18 |
out_txt = "train_images[%d] = %d" % (rn, train_labels[rn])
|
19 |
return fig, out_txt
|
20 |
|