ginipick commited on
Commit
a82e4ad
·
verified ·
1 Parent(s): 236487e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -31,7 +31,7 @@ def preprocess_image(image):
31
 
32
  return image
33
 
34
- # REMOVE THIS LINE: pil_image = preprocess_image(pil_image)
35
 
36
  def patched_json_schema(schema, defs=None):
37
  # Handle boolean schema directly
@@ -196,8 +196,9 @@ def caption_image(image, model_name=default_caption_model):
196
  print(f"Unexpected image type: {type(image)}")
197
  return "Error: Unsupported image type"
198
 
199
- # Apply preprocessing to the PIL image (use the preprocess_image function here)
200
- pil_image = preprocess_image(pil_image)
 
201
 
202
  # Check if model is available
203
  if model_name not in models or model_name not in processors:
 
31
 
32
  return image
33
 
34
+ # DELETE THIS LINE COMPLETELY
35
 
36
  def patched_json_schema(schema, defs=None):
37
  # Handle boolean schema directly
 
196
  print(f"Unexpected image type: {type(image)}")
197
  return "Error: Unsupported image type"
198
 
199
+ # Convert input to RGB if needed
200
+ if pil_image.mode != "RGB":
201
+ pil_image = pil_image.convert("RGB")
202
 
203
  # Check if model is available
204
  if model_name not in models or model_name not in processors: