panik commited on
Commit
032b2fc
·
1 Parent(s): e338dea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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] != 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
 
@@ -25,7 +25,7 @@ iface = gr.Interface(
25
  #gr.inputs.Number()
26
  gr.inputs.Slider(0, 9)
27
  ],
28
- outputs=[gr.outputs.Image(type="plot"), 'text'],
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
  )