SmilingWolf commited on
Commit
53110df
1 Parent(s): 72ed04a

Model expects BGR image

Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -32,6 +32,10 @@ def prepare_image(image: Image.Image, target_size: int):
32
  # Convert to numpy array
33
  # Based on the ONNX graph, the model appears to expect inputs in the range of 0-255
34
  image_array = np.asarray(padded_image, dtype=np.float32)
 
 
 
 
35
  return np.expand_dims(image_array, axis=0)
36
 
37
 
 
32
  # Convert to numpy array
33
  # Based on the ONNX graph, the model appears to expect inputs in the range of 0-255
34
  image_array = np.asarray(padded_image, dtype=np.float32)
35
+
36
+ # Convert PIL-native RGB to BGR
37
+ image_array = image_array[:, :, ::-1]
38
+
39
  return np.expand_dims(image_array, axis=0)
40
 
41