zliang commited on
Commit
e8ad557
1 Parent(s): 018894b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -26,6 +26,7 @@ def infer_image_and_get_boxes(image, confidence_threshold=0.6):
26
  return boxes
27
 
28
  # Function to crop images from the boxes
 
29
  def crop_images_from_boxes(image, boxes, scale_factor):
30
  cropped_images = [
31
  image[int(y1 * scale_factor):int(y2 * scale_factor), int(x1 * scale_factor):int(x2 * scale_factor)]
@@ -33,7 +34,7 @@ def crop_images_from_boxes(image, boxes, scale_factor):
33
  ]
34
  return cropped_images
35
 
36
-
37
  def process_pdf(pdf_file):
38
  # Open the PDF file
39
  doc = fitz.open(pdf_file)
 
26
  return boxes
27
 
28
  # Function to crop images from the boxes
29
+ @spaces.GPU
30
  def crop_images_from_boxes(image, boxes, scale_factor):
31
  cropped_images = [
32
  image[int(y1 * scale_factor):int(y2 * scale_factor), int(x1 * scale_factor):int(x2 * scale_factor)]
 
34
  ]
35
  return cropped_images
36
 
37
+ @spaces.GPU
38
  def process_pdf(pdf_file):
39
  # Open the PDF file
40
  doc = fitz.open(pdf_file)