-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
32 lines (24 loc) · 898 Bytes
/
Copy pathconfig.py
File metadata and controls
32 lines (24 loc) · 898 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
import logging
DEBUG = (
os.environ.get("DEBUG", "False").lower() == "true"
) # If Debug==True runs on localhost with no ssl
PORT = int(os.environ.get("PORT", 7860))
SHARE = os.environ.get("SHARE", "False").lower() == "true"
FORCE_CPU = (
os.environ.get("FORCE_CPU", "False").lower() == "true"
) # TODO CPU ONLY: NOT SUPPORTED -> float16
SSL_CERTFILE = "certificates/cert.pem"
SSL_KEYFILE = "certificates/key.pem"
def setup_logging() -> None:
"Centralized logging configuration"
log_level = logging.DEBUG if DEBUG else logging.INFO
logging.basicConfig(
level=log_level, format="%(asctime)s - %(levelname)s - %(message)s"
)
setup_logging()
logging.debug(
f"Configuration: Debug:{DEBUG}, PORT:{PORT}, SHARE:{SHARE}, FORCE_CPU:{FORCE_CPU}"
)
if FORCE_CPU:
raise NotImplementedError("CPU-only mode is not yet supported in this application.")