Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
17 |
def udop_box_inference(image, text_prompt, box_coordinates):
|
18 |
box_coordinates = [box_coordinates[0], box_coordinates[1], box_coordinates[3], box_coordinates[4]]
|
19 |
|
20 |
-
extracted_image = extract_box(
|
21 |
extracted_image.save("cropped_image.png")
|
22 |
|
23 |
reader = easyocr.Reader(['en'])
|
@@ -50,7 +50,6 @@ def normalize_bbox(bbox, width, height):
|
|
50 |
|
51 |
|
52 |
def extract_box(image_path, coordinates):
|
53 |
-
image = Image.open(image_path)
|
54 |
x, y, x2, y2 = coordinates
|
55 |
cropped_image = image.crop((x, y, x2, y2))
|
56 |
return cropped_image
|
|
|
17 |
def udop_box_inference(image, text_prompt, box_coordinates):
|
18 |
box_coordinates = [box_coordinates[0], box_coordinates[1], box_coordinates[3], box_coordinates[4]]
|
19 |
|
20 |
+
extracted_image = extract_box(image, box_coordinates)
|
21 |
extracted_image.save("cropped_image.png")
|
22 |
|
23 |
reader = easyocr.Reader(['en'])
|
|
|
50 |
|
51 |
|
52 |
def extract_box(image_path, coordinates):
|
|
|
53 |
x, y, x2, y2 = coordinates
|
54 |
cropped_image = image.crop((x, y, x2, y2))
|
55 |
return cropped_image
|