PSNbst commited on
Commit
740b171
·
verified ·
1 Parent(s): b80196d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -28,9 +28,9 @@ def analyze_images(image_a, image_b):
28
  features = clip_model.get_image_features(**inputs)
29
  return features.detach().numpy()
30
 
31
- # 加载图片
32
- img_a = Image.open(image_a).convert("RGB")
33
- img_b = Image.open(image_b).convert("RGB")
34
 
35
  # 生成描述
36
  caption_a = generate_caption(img_a)
 
28
  features = clip_model.get_image_features(**inputs)
29
  return features.detach().numpy()
30
 
31
+ # 图像已经是 PIL.Image 对象,直接处理
32
+ img_a = image_a.convert("RGB")
33
+ img_b = image_b.convert("RGB")
34
 
35
  # 生成描述
36
  caption_a = generate_caption(img_a)