ydshieh commited on
Commit
0ca7ab6
1 Parent(s): 679d099

convert to RGB if necessary

Browse files
Files changed (1) hide show
  1. model.py +3 -0
model.py CHANGED
@@ -46,6 +46,9 @@ def generate(pixel_values):
46
 
47
  def predict(image):
48
 
 
 
 
49
  pixel_values = feature_extractor(images=image, return_tensors="np").pixel_values
50
 
51
  output_ids = generate(pixel_values)
 
46
 
47
  def predict(image):
48
 
49
+ if image.mode != "RGB":
50
+ image = image.convert(mode="RGB")
51
+
52
  pixel_values = feature_extractor(images=image, return_tensors="np").pixel_values
53
 
54
  output_ids = generate(pixel_values)