Upload 2 files
Browse files- app.py +1 -1
- 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="
|
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(
|
145 |
try:
|
146 |
|
147 |
-
image =
|
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')
|