Commit
·
fbe7fc9
1
Parent(s):
e6c2ed8
Fixed normalization error when only 1 image is sent to endpoint
Browse files- handler.py +2 -2
handler.py
CHANGED
@@ -225,8 +225,8 @@ class EndpointHandler:
|
|
225 |
|
226 |
batch_emb = batch_emb.cpu().detach().numpy()
|
227 |
# NORMALIZE
|
228 |
-
|
229 |
-
|
230 |
# transpose back to (21, 512)
|
231 |
batch_emb = batch_emb.T.tolist()
|
232 |
embedding_end_time = timeit.default_timer()
|
|
|
225 |
|
226 |
batch_emb = batch_emb.cpu().detach().numpy()
|
227 |
# NORMALIZE
|
228 |
+
if batch_emb.ndim > 1:
|
229 |
+
batch_emb = batch_emb.T / np.linalg.norm(batch_emb, axis=1)
|
230 |
# transpose back to (21, 512)
|
231 |
batch_emb = batch_emb.T.tolist()
|
232 |
embedding_end_time = timeit.default_timer()
|