Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -55,7 +55,7 @@ def process_image(image):
|
|
55 |
#print(area)
|
56 |
#if area < 120:
|
57 |
bounding_boxes.append(cv2.boundingRect(c))
|
58 |
-
print("for loop bb: ",bounding_boxes)
|
59 |
|
60 |
boundingBoxes_filter = [i for i in bounding_boxes if i != (0 , 0, 128, 128)]
|
61 |
|
@@ -64,7 +64,7 @@ def process_image(image):
|
|
64 |
#
|
65 |
#print(boundingBoxes_2)
|
66 |
for (x, y, w, h) in boundingBoxes:
|
67 |
-
print(x,y,w,h)
|
68 |
ROI = thresh[y:y+h, x:x+w]
|
69 |
ROI2 = cv2.bitwise_not(ROI)
|
70 |
borderoutput = cv2.copyMakeBorder(ROI2, 30, 30, 30, 30, cv2.BORDER_CONSTANT, value=[0, 0, 0])
|
@@ -77,7 +77,7 @@ def process_image(image):
|
|
77 |
pixel_values = processor(img, return_tensors="pt").pixel_values
|
78 |
generated_ids = model.generate(pixel_values)
|
79 |
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
80 |
-
print(generated_text)
|
81 |
generated_text_list.append(generated_text)
|
82 |
#img = Image.fromarray(image.astype('uint8')).convert("RGB")
|
83 |
#img = Image.open("image.png").convert("RGB")
|
|
|
55 |
#print(area)
|
56 |
#if area < 120:
|
57 |
bounding_boxes.append(cv2.boundingRect(c))
|
58 |
+
#print("for loop bb: ",bounding_boxes)
|
59 |
|
60 |
boundingBoxes_filter = [i for i in bounding_boxes if i != (0 , 0, 128, 128)]
|
61 |
|
|
|
64 |
#
|
65 |
#print(boundingBoxes_2)
|
66 |
for (x, y, w, h) in boundingBoxes:
|
67 |
+
#print(x,y,w,h)
|
68 |
ROI = thresh[y:y+h, x:x+w]
|
69 |
ROI2 = cv2.bitwise_not(ROI)
|
70 |
borderoutput = cv2.copyMakeBorder(ROI2, 30, 30, 30, 30, cv2.BORDER_CONSTANT, value=[0, 0, 0])
|
|
|
77 |
pixel_values = processor(img, return_tensors="pt").pixel_values
|
78 |
generated_ids = model.generate(pixel_values)
|
79 |
generated_text = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
80 |
+
#print(generated_text)
|
81 |
generated_text_list.append(generated_text)
|
82 |
#img = Image.fromarray(image.astype('uint8')).convert("RGB")
|
83 |
#img = Image.open("image.png").convert("RGB")
|