Ariamehr commited on
Commit
8e6fd23
·
verified ·
1 Parent(s): 8871d7e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -9,13 +9,13 @@ model = torch.jit.load(model_path, map_location=torch.device('cpu'))
9
  model.eval()
10
 
11
  # Define a function to preprocess images to match the expected input shape
 
12
  def preprocess_image(image):
13
- # Resize the image to a fixed size (e.g., 16x16) to match the expected input shape
14
- image = image.resize((16, 16))
15
 
16
- # Convert to RGB and normalize pixel values
17
- image = image.convert("RGB")
18
- input_tensor = np.array(image) / 255.0
19
 
20
  # Add the batch dimension
21
  input_tensor = input_tensor[np.newaxis, :]
 
9
  model.eval()
10
 
11
  # Define a function to preprocess images to match the expected input shape
12
+
13
  def preprocess_image(image):
14
+ # Resize the image to a fixed size (e.g., 224x224)
15
+ image = image.resize((1024, 768))
16
 
17
+ # Convert to RGB (without adding extra dimensions)
18
+ input_tensor = np.array(image.convert("RGB")) / 255.0
 
19
 
20
  # Add the batch dimension
21
  input_tensor = input_tensor[np.newaxis, :]