IncreasingLoss commited on
Commit
4e539c0
·
verified ·
1 Parent(s): 9cfa170

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -29,7 +29,7 @@ css = """
29
  }
30
  """
31
 
32
- # Preprocessing
33
  preprocess = transforms.Compose([
34
  transforms.Resize(256),
35
  transforms.CenterCrop(224),
@@ -37,6 +37,11 @@ preprocess = transforms.Compose([
37
  transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
38
  ])
39
 
 
 
 
 
 
40
  def predict(img_path):
41
  """Process single image and return prediction"""
42
  if not img_path:
 
29
  }
30
  """
31
 
32
+ # PREPROCESSING PIPELINE (ADD THIS BACK)
33
  preprocess = transforms.Compose([
34
  transforms.Resize(256),
35
  transforms.CenterCrop(224),
 
37
  transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
38
  ])
39
 
40
+ # Precompute example image paths
41
+ example_dir = "examples"
42
+ example_images = [os.path.join(example_dir, f) for f in os.listdir(example_dir)
43
+ if f.lower().endswith(('.png', '.jpg', '.jpeg', '.webp'))]
44
+
45
  def predict(img_path):
46
  """Process single image and return prediction"""
47
  if not img_path: