Itanutiwari527 commited on
Commit
397ddf1
·
verified ·
1 Parent(s): b849c01

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -17,7 +17,7 @@ labels = requests.get(LABELS_URL).text.strip().split("\n")
17
 
18
  # Image transform
19
  transform = transforms.Compose([
20
- transforms.Resize((224, 224)),
21
  transforms.ToTensor(),
22
  ])
23
 
@@ -62,7 +62,7 @@ def main():
62
 
63
  def load_image():
64
  if uploaded_file:
65
- return Image.open(uploaded_file).resize(244,244)
66
  elif selected_preset:
67
  return Image.open(presets[selected_preset])
68
  else:
@@ -93,7 +93,7 @@ def main():
93
  st.markdown("### Adversarial Prediction")
94
  st.error(adversarial_label)
95
  # Ensure the perturbed image has the same size as the original image
96
- perturbed_image_resized = perturbed_image.resize(image.size) # Resize to match original image size
97
  st.image(perturbed_image_resized, caption="Perturbed Image", use_container_width=True)
98
  else:
99
  st.warning("Please upload image.")
 
17
 
18
  # Image transform
19
  transform = transforms.Compose([
20
+ transforms.Resize((224, 224)), # Ensuring image is resized to (224, 224)
21
  transforms.ToTensor(),
22
  ])
23
 
 
62
 
63
  def load_image():
64
  if uploaded_file:
65
+ return Image.open(uploaded_file).resize((224, 224)) # Resize to (224, 224)
66
  elif selected_preset:
67
  return Image.open(presets[selected_preset])
68
  else:
 
93
  st.markdown("### Adversarial Prediction")
94
  st.error(adversarial_label)
95
  # Ensure the perturbed image has the same size as the original image
96
+ perturbed_image_resized = perturbed_image.resize((224, 224)) # Resize to (224, 224)
97
  st.image(perturbed_image_resized, caption="Perturbed Image", use_container_width=True)
98
  else:
99
  st.warning("Please upload image.")