Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -99,7 +99,8 @@ epsilon = 0.20 # Tweak epsilon to change the intensity of perturbation
|
|
99 |
adversarial_examples = []
|
100 |
|
101 |
for i in range(10):
|
102 |
-
img =
|
|
|
103 |
label = tf.reshape(tf.convert_to_tensor([i]), [1, 1])
|
104 |
perturbations = create_adversarial_pattern(img, label)
|
105 |
adv_x = fgsm_attack(img, epsilon, perturbations)
|
|
|
99 |
adversarial_examples = []
|
100 |
|
101 |
for i in range(10):
|
102 |
+
img = preprocess_image(mnist_examples[i][0])
|
103 |
+
img = tf.convert_to_tensor(img, dtype=tf.float32)
|
104 |
label = tf.reshape(tf.convert_to_tensor([i]), [1, 1])
|
105 |
perturbations = create_adversarial_pattern(img, label)
|
106 |
adv_x = fgsm_attack(img, epsilon, perturbations)
|