Spaces:
No application file
No application file
Commit ·
85ee3ea
1
Parent(s): 96025ae
Fixed small bug
Browse files
app.py
CHANGED
|
@@ -108,7 +108,7 @@ with gr.Blocks() as demo:
|
|
| 108 |
def get_yolo_predictions_local(image):
|
| 109 |
# Perform object detection on an image using the model
|
| 110 |
predictions = model(image, conf=0.1)
|
| 111 |
-
print("predictions", predictions)
|
| 112 |
return predictions
|
| 113 |
|
| 114 |
def ocr(sub_image):
|
|
@@ -155,9 +155,10 @@ with gr.Blocks() as demo:
|
|
| 155 |
search_query = search_url + urllib.parse.quote(ref)
|
| 156 |
if ref not in sku:
|
| 157 |
sku.append(ref)
|
| 158 |
-
if search_query not in hotspots_sku_links:
|
| 159 |
hotspots_sku_links.append(search_query)
|
| 160 |
hostpots.append(((x, y, x + w, y + h), ref))
|
|
|
|
| 161 |
return (img, hostpots)
|
| 162 |
else:
|
| 163 |
# get the height and width of the image
|
|
@@ -170,8 +171,6 @@ with gr.Blocks() as demo:
|
|
| 170 |
coordinates = coordinates.numpy()
|
| 171 |
print("FOUND {} objects".format(len(coordinates)))
|
| 172 |
for idx, coord in enumerate(coordinates):
|
| 173 |
-
print(coord.shape)
|
| 174 |
-
print("coord", coord)
|
| 175 |
# crop the image to the bounding box
|
| 176 |
x = int(coord[0])
|
| 177 |
y = int(coord[1])
|
|
@@ -193,9 +192,12 @@ with gr.Blocks() as demo:
|
|
| 193 |
search_query = search_url + urllib.parse.quote(ref)
|
| 194 |
if ref not in sku:
|
| 195 |
sku.append(ref)
|
| 196 |
-
if search_query not in hotspots_sku_links:
|
| 197 |
-
|
| 198 |
-
|
|
|
|
|
|
|
|
|
|
| 199 |
return (img, hostpots)
|
| 200 |
|
| 201 |
|
|
|
|
| 108 |
def get_yolo_predictions_local(image):
|
| 109 |
# Perform object detection on an image using the model
|
| 110 |
predictions = model(image, conf=0.1)
|
| 111 |
+
# print("predictions", predictions)
|
| 112 |
return predictions
|
| 113 |
|
| 114 |
def ocr(sub_image):
|
|
|
|
| 155 |
search_query = search_url + urllib.parse.quote(ref)
|
| 156 |
if ref not in sku:
|
| 157 |
sku.append(ref)
|
| 158 |
+
# if search_query not in hotspots_sku_links:
|
| 159 |
hotspots_sku_links.append(search_query)
|
| 160 |
hostpots.append(((x, y, x + w, y + h), ref))
|
| 161 |
+
|
| 162 |
return (img, hostpots)
|
| 163 |
else:
|
| 164 |
# get the height and width of the image
|
|
|
|
| 171 |
coordinates = coordinates.numpy()
|
| 172 |
print("FOUND {} objects".format(len(coordinates)))
|
| 173 |
for idx, coord in enumerate(coordinates):
|
|
|
|
|
|
|
| 174 |
# crop the image to the bounding box
|
| 175 |
x = int(coord[0])
|
| 176 |
y = int(coord[1])
|
|
|
|
| 192 |
search_query = search_url + urllib.parse.quote(ref)
|
| 193 |
if ref not in sku:
|
| 194 |
sku.append(ref)
|
| 195 |
+
# if search_query not in hotspots_sku_links:
|
| 196 |
+
hotspots_sku_links.append(search_query)
|
| 197 |
+
hostpots.append(((int(coord[0]), int(coord[1]), int(coord[2]), int(coord[3])), str(ref)))
|
| 198 |
+
print("hotspots_sku_links", len(), hotspots_sku_links)
|
| 199 |
+
print("sku", sku)
|
| 200 |
+
print("hostpots", hostpots)
|
| 201 |
return (img, hostpots)
|
| 202 |
|
| 203 |
|