Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import cv2
|
|
5 |
import numpy as np
|
6 |
import fitz # PyMuPDF
|
7 |
from PIL import Image
|
8 |
-
|
9 |
# Load the trained model
|
10 |
model_path = 'best.pt' # Replace with the path to your trained .pt file
|
11 |
model = YOLO(model_path)
|
@@ -43,6 +43,7 @@ def crop_images_from_boxes(image, boxes, scale_factor):
|
|
43 |
cropped_images.append(cropped_image)
|
44 |
return cropped_images
|
45 |
|
|
|
46 |
def process_pdf(pdf_file):
|
47 |
# Open the PDF file
|
48 |
doc = fitz.open(pdf_file)
|
|
|
5 |
import numpy as np
|
6 |
import fitz # PyMuPDF
|
7 |
from PIL import Image
|
8 |
+
import spaces
|
9 |
# Load the trained model
|
10 |
model_path = 'best.pt' # Replace with the path to your trained .pt file
|
11 |
model = YOLO(model_path)
|
|
|
43 |
cropped_images.append(cropped_image)
|
44 |
return cropped_images
|
45 |
|
46 |
+
@spaces.gpu
|
47 |
def process_pdf(pdf_file):
|
48 |
# Open the PDF file
|
49 |
doc = fitz.open(pdf_file)
|