Spaces:
Sleeping
Sleeping
Update working_yolo_pipeline.py
Browse filestorch.serialization.add_safe_globals([DetectionModel])
from ultralytics.nn.tasks import DetectionModel
- working_yolo_pipeline.py +4 -0
working_yolo_pipeline.py
CHANGED
|
@@ -11,6 +11,7 @@ import fitz # PyMuPDF
|
|
| 11 |
import numpy as np
|
| 12 |
import cv2
|
| 13 |
from ultralytics import YOLO
|
|
|
|
| 14 |
import glob
|
| 15 |
import pytesseract
|
| 16 |
from PIL import Image
|
|
@@ -202,6 +203,9 @@ def get_latex_from_base64(base64_string: str) -> str:
|
|
| 202 |
# --- CONFIGURATION AND CONSTANTS ---
|
| 203 |
# ============================================================================
|
| 204 |
|
|
|
|
|
|
|
|
|
|
| 205 |
# NOTE: Update these paths to match your environment before running!
|
| 206 |
WEIGHTS_PATH = 'best.pt'
|
| 207 |
DEFAULT_LAYOUTLMV3_MODEL_PATH = "98.pth"
|
|
|
|
| 11 |
import numpy as np
|
| 12 |
import cv2
|
| 13 |
from ultralytics import YOLO
|
| 14 |
+
from ultralytics.nn.tasks import DetectionModel
|
| 15 |
import glob
|
| 16 |
import pytesseract
|
| 17 |
from PIL import Image
|
|
|
|
| 203 |
# --- CONFIGURATION AND CONSTANTS ---
|
| 204 |
# ============================================================================
|
| 205 |
|
| 206 |
+
torch.serialization.add_safe_globals([DetectionModel])
|
| 207 |
+
|
| 208 |
+
|
| 209 |
# NOTE: Update these paths to match your environment before running!
|
| 210 |
WEIGHTS_PATH = 'best.pt'
|
| 211 |
DEFAULT_LAYOUTLMV3_MODEL_PATH = "98.pth"
|