Update hf_demo.py
Browse files- hf_demo.py +0 -12
hf_demo.py
CHANGED
|
@@ -11,7 +11,6 @@ import hashlib
|
|
| 11 |
import logging
|
| 12 |
import sqlite3
|
| 13 |
import requests
|
| 14 |
-
import fcntl
|
| 15 |
from contextlib import contextmanager
|
| 16 |
from datetime import datetime
|
| 17 |
from enum import Enum
|
|
@@ -37,17 +36,6 @@ from infrastructure import (
|
|
| 37 |
RecommendedAction,
|
| 38 |
)
|
| 39 |
|
| 40 |
-
# ============== SINGLE INSTANCE LOCK (per port) ==============
|
| 41 |
-
PORT = int(os.environ.get('PORT', 7860))
|
| 42 |
-
LOCK_FILE = f'/tmp/arf_app_{PORT}.lock'
|
| 43 |
-
try:
|
| 44 |
-
lock_fd = open(LOCK_FILE, 'w')
|
| 45 |
-
fcntl.flock(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
|
| 46 |
-
except (IOError, OSError):
|
| 47 |
-
print(f"Another instance is already running on port {PORT}. Exiting.")
|
| 48 |
-
sys.exit(1)
|
| 49 |
-
# ==============================================================
|
| 50 |
-
|
| 51 |
# ============== CONFIGURATION (Pydantic V2) ==============
|
| 52 |
class Settings(BaseSettings):
|
| 53 |
"""Application settings loaded from environment variables."""
|
|
|
|
| 11 |
import logging
|
| 12 |
import sqlite3
|
| 13 |
import requests
|
|
|
|
| 14 |
from contextlib import contextmanager
|
| 15 |
from datetime import datetime
|
| 16 |
from enum import Enum
|
|
|
|
| 36 |
RecommendedAction,
|
| 37 |
)
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
# ============== CONFIGURATION (Pydantic V2) ==============
|
| 40 |
class Settings(BaseSettings):
|
| 41 |
"""Application settings loaded from environment variables."""
|