Spaces:
Runtime error
Runtime error
Fix pydantic error
Browse files
app.py
CHANGED
@@ -72,7 +72,7 @@ def predict(image, det_choice, emb_choice):
|
|
72 |
cropped_stamp = to_tensor(image.crop(box.tolist()).resize((118, 118)))
|
73 |
embeddings.append(encoder(cropped_stamp.unsqueeze(0).to(device))[0][0].detach().cpu())
|
74 |
|
75 |
-
embeddings = np.stack(embeddings)
|
76 |
|
77 |
similarities = cosine_similarity(embeddings)
|
78 |
|
@@ -96,7 +96,7 @@ outputs = [
|
|
96 |
gr.Image(type="pil"),
|
97 |
gr.DataFrame(type='pandas', label="Bounding boxes"),
|
98 |
gr.DataFrame(type='numpy', label="Embeddings"),
|
99 |
-
gr.Plot(
|
100 |
]
|
101 |
app = gr.Interface(predict, inputs, outputs, examples=examples)
|
102 |
app.launch()
|
|
|
72 |
cropped_stamp = to_tensor(image.crop(box.tolist()).resize((118, 118)))
|
73 |
embeddings.append(encoder(cropped_stamp.unsqueeze(0).to(device))[0][0].detach().cpu())
|
74 |
|
75 |
+
embeddings = np.stack(np.array(embeddings))
|
76 |
|
77 |
similarities = cosine_similarity(embeddings)
|
78 |
|
|
|
96 |
gr.Image(type="pil"),
|
97 |
gr.DataFrame(type='pandas', label="Bounding boxes"),
|
98 |
gr.DataFrame(type='numpy', label="Embeddings"),
|
99 |
+
gr.Plot(label="Cosine Similarities")
|
100 |
]
|
101 |
app = gr.Interface(predict, inputs, outputs, examples=examples)
|
102 |
app.launch()
|