Update app.py
Browse files
app.py
CHANGED
|
@@ -3,8 +3,10 @@ import os
|
|
| 3 |
# --- CPU OPTIMIZATION FLAGS (Must be set before importing Paddle) ---
|
| 4 |
# Hugging Face Free Tier has 2 vCPUs. Limiting threads prevents overhead.
|
| 5 |
os.environ["OMP_NUM_THREADS"] = "2"
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
| 8 |
|
| 9 |
import shutil
|
| 10 |
import json
|
|
@@ -18,7 +20,7 @@ app = FastAPI(
|
|
| 18 |
description="Optimized PaddleOCR-VL extraction"
|
| 19 |
)
|
| 20 |
|
| 21 |
-
print("Initializing PaddleOCR-VL Pipeline (MKLDNN
|
| 22 |
pipeline = PaddleOCRVL()
|
| 23 |
print("Pipeline ready!")
|
| 24 |
|
|
|
|
| 3 |
# --- CPU OPTIMIZATION FLAGS (Must be set before importing Paddle) ---
|
| 4 |
# Hugging Face Free Tier has 2 vCPUs. Limiting threads prevents overhead.
|
| 5 |
os.environ["OMP_NUM_THREADS"] = "2"
|
| 6 |
+
|
| 7 |
+
# DISABLE MKLDNN: PaddleOCR-VL transformer ops are currently incompatible
|
| 8 |
+
# with the oneDNN instruction converter in Paddle's new executor.
|
| 9 |
+
os.environ["FLAGS_use_mkldnn"] = "0"
|
| 10 |
|
| 11 |
import shutil
|
| 12 |
import json
|
|
|
|
| 20 |
description="Optimized PaddleOCR-VL extraction"
|
| 21 |
)
|
| 22 |
|
| 23 |
+
print("Initializing PaddleOCR-VL Pipeline (MKLDNN Disabled)...")
|
| 24 |
pipeline = PaddleOCRVL()
|
| 25 |
print("Pipeline ready!")
|
| 26 |
|