alvarobartt HF staff commited on
Commit
1d147a4
·
verified ·
1 Parent(s): 9a3f2eb

Convert image to RGB to prevent error

Browse files

The error otherwise is e.g. for RGBA images (as the one in the example) "RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0"

Files changed (1) hide show
  1. README.md +1 -0
README.md CHANGED
@@ -149,6 +149,7 @@ model.to("cuda")
149
  # Inference
150
  url = "https://assets-c4akfrf5b4d3f4b7.z01.azurefd.net/assets/2024/04/BMDataViz_661fb89f3845e.png"
151
  image = Image.open(BytesIO(requests.get(url, stream=True).content))
 
152
 
153
  convs = [
154
  {"role": "system", "content": "You are agent that can see, talk and act."},
 
149
  # Inference
150
  url = "https://assets-c4akfrf5b4d3f4b7.z01.azurefd.net/assets/2024/04/BMDataViz_661fb89f3845e.png"
151
  image = Image.open(BytesIO(requests.get(url, stream=True).content))
152
+ image = image.convert("rgb")
153
 
154
  convs = [
155
  {"role": "system", "content": "You are agent that can see, talk and act."},