zliang commited on
Commit
ac2d267
·
verified ·
1 Parent(s): 89415f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
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)