chanhua commited on
Commit
d00ba07
1 Parent(s): 7eb62d4

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +1 -1
  2. image_feature.py +2 -2
app.py CHANGED
@@ -29,7 +29,7 @@ def work11(image1, image2):
29
  demo = gr.Interface(title="图片相似度推理",
30
  css="",
31
  fn=work11,
32
- inputs=[gr.Image(type="filepath", label="图片1"), gr.Image(type="filepath", label="图片2")],
33
  outputs=[gr.Textbox(lines=3, label="推理结果")])
34
  #
35
  # # demo = gr.Interface(fn=work, inputs="image,text", outputs="text")
 
29
  demo = gr.Interface(title="图片相似度推理",
30
  css="",
31
  fn=work11,
32
+ inputs=[gr.Image(type="pil", label="图片1"), gr.Image(type="pil", label="图片2")],
33
  outputs=[gr.Textbox(lines=3, label="推理结果")])
34
  #
35
  # # demo = gr.Interface(fn=work, inputs="image,text", outputs="text")
image_feature.py CHANGED
@@ -141,10 +141,10 @@ def infer1(image1, image2):
141
  print("这是finally块")
142
 
143
  # 输出图片向量
144
- def xiang(url):
145
  try:
146
 
147
- image = Image.open(url).convert('RGB')
148
 
149
  processor = AutoImageProcessor.from_pretrained('facebook/dinov2-giant')
150
  model = AutoModel.from_pretrained('facebook/dinov2-giant')
 
141
  print("这是finally块")
142
 
143
  # 输出图片向量
144
+ def xiang(upload_image):
145
  try:
146
 
147
+ image = upload_image.convert('RGB')
148
 
149
  processor = AutoImageProcessor.from_pretrained('facebook/dinov2-giant')
150
  model = AutoModel.from_pretrained('facebook/dinov2-giant')