Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ import numpy as np
|
|
6 |
import fitz # PyMuPDF
|
7 |
from PIL import Image
|
8 |
from concurrent.futures import ThreadPoolExecutor, as_completed
|
9 |
-
|
10 |
# Load the trained model globally
|
11 |
model_path = 'best.pt' # Replace with the path to your trained .pt file
|
12 |
model = YOLO(model_path)
|
@@ -68,6 +68,7 @@ def process_single_page(page, low_dpi, high_dpi, scale_factor):
|
|
68 |
print(f"Error processing page: {e}")
|
69 |
return []
|
70 |
|
|
|
71 |
def process_pdf(pdf_file):
|
72 |
# Open the PDF file
|
73 |
doc = fitz.open(pdf_file)
|
|
|
6 |
import fitz # PyMuPDF
|
7 |
from PIL import Image
|
8 |
from concurrent.futures import ThreadPoolExecutor, as_completed
|
9 |
+
import spaces
|
10 |
# Load the trained model globally
|
11 |
model_path = 'best.pt' # Replace with the path to your trained .pt file
|
12 |
model = YOLO(model_path)
|
|
|
68 |
print(f"Error processing page: {e}")
|
69 |
return []
|
70 |
|
71 |
+
@spaces.GPU
|
72 |
def process_pdf(pdf_file):
|
73 |
# Open the PDF file
|
74 |
doc = fitz.open(pdf_file)
|