Spaces:
Runtime error
Runtime error
Commit
·
a1a1e17
1
Parent(s):
cf029f9
tweaks
Browse files
app.py
CHANGED
@@ -31,8 +31,8 @@ with gr.Blocks() as demo:
|
|
31 |
with gr.Row():
|
32 |
with gr.Column(scale=1):
|
33 |
input_image = gr.Image(type="pil")
|
34 |
-
with gr.Column(scale=
|
35 |
-
output_image = gr.Gallery()
|
36 |
|
37 |
|
38 |
@input_image.upload(inputs=input_image, outputs=output_image)
|
@@ -41,7 +41,7 @@ with gr.Blocks() as demo:
|
|
41 |
inputs = extractor(images=resized_image, return_tensors="pt")
|
42 |
outputs = model(**inputs)
|
43 |
embed = outputs.last_hidden_state[0][0]
|
44 |
-
result = index.query(vector=embed.tolist(), top_k=
|
45 |
return [dataset["train"][int(vector.id[3:])]["image"] for vector in result]
|
46 |
|
47 |
with gr.Tab("Advanced"):
|
|
|
31 |
with gr.Row():
|
32 |
with gr.Column(scale=1):
|
33 |
input_image = gr.Image(type="pil")
|
34 |
+
with gr.Column(scale=2):
|
35 |
+
output_image = gr.Gallery(height=600)
|
36 |
|
37 |
|
38 |
@input_image.upload(inputs=input_image, outputs=output_image)
|
|
|
41 |
inputs = extractor(images=resized_image, return_tensors="pt")
|
42 |
outputs = model(**inputs)
|
43 |
embed = outputs.last_hidden_state[0][0]
|
44 |
+
result = index.query(vector=embed.tolist(), top_k=4)
|
45 |
return [dataset["train"][int(vector.id[3:])]["image"] for vector in result]
|
46 |
|
47 |
with gr.Tab("Advanced"):
|