Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,27 +2,6 @@ import os
|
|
| 2 |
from dotenv import load_dotenv
|
| 3 |
import sys
|
| 4 |
import multiprocessing
|
| 5 |
-
# Prevent leaked-semaphore warning on macOS when SentenceTransformer / tokenizers
|
| 6 |
-
# fork background processes. Must be called before any other multiprocessing use.
|
| 7 |
-
try:
|
| 8 |
-
multiprocessing.set_start_method("spawn", force=True)
|
| 9 |
-
except RuntimeError:
|
| 10 |
-
pass # already set
|
| 11 |
-
|
| 12 |
-
# Clean up any leaked semaphores at interpreter exit so the resource-tracker
|
| 13 |
-
# doesn't emit a noisy warning on Ctrl-C.
|
| 14 |
-
import atexit, multiprocessing.resource_tracker as _rt
|
| 15 |
-
|
| 16 |
-
def _cleanup_semaphores():
|
| 17 |
-
"""Silence 'leaked semaphore' warnings at shutdown cleanly."""
|
| 18 |
-
warnings.filterwarnings(
|
| 19 |
-
"ignore",
|
| 20 |
-
message=".*leaked.*",
|
| 21 |
-
category=UserWarning,
|
| 22 |
-
module="multiprocessing.resource_tracker"
|
| 23 |
-
)
|
| 24 |
-
|
| 25 |
-
atexit.register(_cleanup_semaphores)
|
| 26 |
|
| 27 |
# Add src to path for imports - handles both local (../src) and container/HF (./src) structures
|
| 28 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
|
|
| 2 |
from dotenv import load_dotenv
|
| 3 |
import sys
|
| 4 |
import multiprocessing
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
# Add src to path for imports - handles both local (../src) and container/HF (./src) structures
|
| 7 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|