Spaces:
Build error
Build error
app
Browse files
app.py
CHANGED
@@ -43,7 +43,7 @@ topK = 5
|
|
43 |
T2I = "以文搜图"
|
44 |
I2I = "以图搜图"
|
45 |
|
46 |
-
|
47 |
UEFDT = "双塔联合融合"
|
48 |
IEFDT = "双塔嵌入融合"
|
49 |
ViLT = "视觉语言预训练"
|
@@ -99,7 +99,7 @@ def search(mode, method, image, text):
|
|
99 |
if method == ViLT:
|
100 |
pass
|
101 |
else:
|
102 |
-
if method ==
|
103 |
elif method == UEFDT: swap_width = 2
|
104 |
elif method == IEFDT: swap_width = 1
|
105 |
|
@@ -152,7 +152,7 @@ if __name__ == "__main__":
|
|
152 |
fn=search,
|
153 |
inputs=[
|
154 |
gr.inputs.Radio([I2I, T2I]),
|
155 |
-
gr.inputs.Radio([
|
156 |
gr.inputs.Image(shape=(400, 400), label="Image to search", optional=True),
|
157 |
gr.inputs.Textbox(
|
158 |
lines=1, label="Text query", placeholder="please input text query here...",
|
@@ -167,7 +167,7 @@ if __name__ == "__main__":
|
|
167 |
gr.outputs.Image(type="auto", label="5rd Best match")
|
168 |
],
|
169 |
examples=[
|
170 |
-
[I2I,
|
171 |
[I2I, ViLT, dog_image, ""],
|
172 |
[T2I, UEFDT, w1_image, "a woman is walking on the road"],
|
173 |
[T2I, IEFDT, w2_image, "a boy is eating apple"],
|
|
|
43 |
T2I = "以文搜图"
|
44 |
I2I = "以图搜图"
|
45 |
|
46 |
+
DPDT = "双塔动态池化"
|
47 |
UEFDT = "双塔联合融合"
|
48 |
IEFDT = "双塔嵌入融合"
|
49 |
ViLT = "视觉语言预训练"
|
|
|
99 |
if method == ViLT:
|
100 |
pass
|
101 |
else:
|
102 |
+
if method == DPDT: swap_width = 5
|
103 |
elif method == UEFDT: swap_width = 2
|
104 |
elif method == IEFDT: swap_width = 1
|
105 |
|
|
|
152 |
fn=search,
|
153 |
inputs=[
|
154 |
gr.inputs.Radio([I2I, T2I]),
|
155 |
+
gr.inputs.Radio([DPDT, UEFDT, IEFDT, ViLT]),
|
156 |
gr.inputs.Image(shape=(400, 400), label="Image to search", optional=True),
|
157 |
gr.inputs.Textbox(
|
158 |
lines=1, label="Text query", placeholder="please input text query here...",
|
|
|
167 |
gr.outputs.Image(type="auto", label="5rd Best match")
|
168 |
],
|
169 |
examples=[
|
170 |
+
[I2I, DPDT, cat_image, ""],
|
171 |
[I2I, ViLT, dog_image, ""],
|
172 |
[T2I, UEFDT, w1_image, "a woman is walking on the road"],
|
173 |
[T2I, IEFDT, w2_image, "a boy is eating apple"],
|