Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -217,7 +217,10 @@ app.prepare(ctx_id=-1, det_size=(IMAGE_SHAPE, IMAGE_SHAPE)) # Use ctx_id=-1 if
|
|
| 217 |
# Define the ML model - Evaluation function
|
| 218 |
def prod_function(app, prod_path, webcam_path):
|
| 219 |
webcam_img = Image.open(webcam_path)
|
| 220 |
-
|
|
|
|
|
|
|
|
|
|
| 221 |
webcam_emb = webcam_emb[0].embedding
|
| 222 |
|
| 223 |
similarity_score = []
|
|
|
|
| 217 |
# Define the ML model - Evaluation function
|
| 218 |
def prod_function(app, prod_path, webcam_path):
|
| 219 |
webcam_img = Image.open(webcam_path)
|
| 220 |
+
np_webcam = np.array(webcam_img) # Convert to NumPy array
|
| 221 |
+
cv2_webcam = cv2.cvtColor(np_image, cv2.COLOR_RGB2BGR) # Convert RGB (PIL) to BGR (OpenCV)
|
| 222 |
+
|
| 223 |
+
webcam_emb = app.get(cv2_webcam, max_num=1)
|
| 224 |
webcam_emb = webcam_emb[0].embedding
|
| 225 |
|
| 226 |
similarity_score = []
|