Spaces:
Paused
Paused
fix
Browse files- api.py +2 -1
- signature/inference.py +2 -1
api.py
CHANGED
|
@@ -37,7 +37,8 @@ app.add_middleware(
|
|
| 37 |
|
| 38 |
# Thread pool executor for running blocking CPU/GPU operations concurrently
|
| 39 |
# This allows multiple PDFs to be processed in parallel
|
| 40 |
-
|
|
|
|
| 41 |
|
| 42 |
|
| 43 |
@app.on_event("startup")
|
|
|
|
| 37 |
|
| 38 |
# Thread pool executor for running blocking CPU/GPU operations concurrently
|
| 39 |
# This allows multiple PDFs to be processed in parallel
|
| 40 |
+
# Adjust based on your GPU/CPU capacity
|
| 41 |
+
executor = ThreadPoolExecutor(max_workers=4)
|
| 42 |
|
| 43 |
|
| 44 |
@app.on_event("startup")
|
signature/inference.py
CHANGED
|
@@ -36,7 +36,8 @@ def detect_signatures(image_path, model=None, output_dir=None, signatures_dir=No
|
|
| 36 |
else:
|
| 37 |
try:
|
| 38 |
# Get HF token from environment (for gated models)
|
| 39 |
-
hf_token = os.environ.get(
|
|
|
|
| 40 |
model_path = hf_hub_download(
|
| 41 |
repo_id="tech4humans/yolov8s-signature-detector",
|
| 42 |
filename="yolov8s.pt",
|
|
|
|
| 36 |
else:
|
| 37 |
try:
|
| 38 |
# Get HF token from environment (for gated models)
|
| 39 |
+
hf_token = os.environ.get(
|
| 40 |
+
"HF_TOKEN") or os.environ.get("HUGGINGFACE_TOKEN")
|
| 41 |
model_path = hf_hub_download(
|
| 42 |
repo_id="tech4humans/yolov8s-signature-detector",
|
| 43 |
filename="yolov8s.pt",
|