panik commited on
Commit
835dfc3
·
1 Parent(s): fe16b6b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -7,7 +7,7 @@ import random
7
 
8
  (train_images, train_labels), (test_images, test_labels) = mnist.load_data()
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):
@@ -19,14 +19,15 @@ def pick_digit(digit_choice):
19
  return fig, out_txt
20
 
21
  iface = gr.Interface(
22
- fn = pick_digit,
23
- inputs = [
24
  #gr.inputs.Dropdown([0, 1, 2, 3])
25
- gr.inputs.Number()
26
- ],
 
27
  outputs=[gr.outputs.Image(type="plot"), 'text'],
28
- title='page title',
29
- description='page description'
30
  )
31
 
32
  iface.launch()
 
7
 
8
  (train_images, train_labels), (test_images, test_labels) = mnist.load_data()
9
 
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):
 
19
  return fig, out_txt
20
 
21
  iface = gr.Interface(
22
+ fn = sample_digit,
23
+ inputs = ('digit', [
24
  #gr.inputs.Dropdown([0, 1, 2, 3])
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
  )
32
 
33
  iface.launch()