dalexanderch commited on
Commit
a4da7de
·
1 Parent(s): b0e5419

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -121,9 +121,7 @@ def iterative_least_likely_fgsm_cifar10(image, model, epsilon, alpha, niter, nb_
121
  # adv_x = adv_x * 0.5 + 0.5
122
  return adv_x.numpy()
123
 
124
- def fn(dataset, attack):
125
- epsilon=15/255
126
- alpha=1/255
127
  niter = int(min(4 + epsilon*255, 1.25 * epsilon * 255))
128
  nb_classes = 10
129
  classes = ["airplane", "automobile", "bird", "cat", "deer", "dog", "frog", "horse", "ship", "truck"]
@@ -186,7 +184,9 @@ demo = gr.Interface(
186
  description="A random image from the chosen dataset will be perturbated with the chosen attack type and both the original image and the perturbated image will be displayed.",
187
  inputs=[
188
  gr.Radio(choices=["MNIST", "CIFAR10"], label="Pick a dataset"),
189
- gr.Radio(choices=["FGSM", "I-FGSM", "I-LL-FGSM"], label="Pick an attack")
 
 
190
  ],
191
  outputs=[
192
  gr.Image(label="Original Image").style(height=256,width=256),
 
121
  # adv_x = adv_x * 0.5 + 0.5
122
  return adv_x.numpy()
123
 
124
+ def fn(dataset, attack, epsilon, alpha):
 
 
125
  niter = int(min(4 + epsilon*255, 1.25 * epsilon * 255))
126
  nb_classes = 10
127
  classes = ["airplane", "automobile", "bird", "cat", "deer", "dog", "frog", "horse", "ship", "truck"]
 
184
  description="A random image from the chosen dataset will be perturbated with the chosen attack type and both the original image and the perturbated image will be displayed.",
185
  inputs=[
186
  gr.Radio(choices=["MNIST", "CIFAR10"], label="Pick a dataset"),
187
+ gr.Radio(choices=["FGSM", "I-FGSM", "I-LL-FGSM"], label="Pick an attack"),
188
+ gr.Number(value=15, label="Epsilon"),
189
+ gr.Number(value=1, label="Alpha")
190
  ],
191
  outputs=[
192
  gr.Image(label="Original Image").style(height=256,width=256),