AI-RESEARCHER-2024 commited on
Commit
4909156
·
verified ·
1 Parent(s): a07c86f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
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 = tf.convert_to_tensor(mnist_examples[i][0].reshape((1, 28, 28, 1)), dtype=tf.float32)
 
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)