bcc36d14a1
* consolidated endpoints, added live configuration * added ml settings to server * added settings dashboard * updated deps, fixed typos * simplified modelconfig updated tests * Added ml setting accordion for admin page updated tests * merge `clipText` and `clipVision` * added face distance setting clarified setting * add clip mode in request, dropdown for face models * polished ml settings updated descriptions * update clip field on error * removed unused import * add description for image classification threshold * pin safetensors for arm wheel updated poetry lock * moved dto * set model type only in ml repository * revert form-data package install use fetch instead of axios * added slotted description with link updated facial recognition description clarified effect of disabling tasks * validation before model load * removed unnecessary getconfig call * added migration * updated api updated api updated api --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
33 lines
765 B
Python
33 lines
765 B
Python
import os
|
|
from pathlib import Path
|
|
|
|
from pydantic import BaseSettings
|
|
|
|
from .schemas import ModelType
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
cache_folder: str = "/cache"
|
|
eager_startup: bool = False
|
|
model_ttl: int = 0
|
|
host: str = "0.0.0.0"
|
|
port: int = 3003
|
|
workers: int = 1
|
|
test_full: bool = False
|
|
request_threads: int = os.cpu_count() or 4
|
|
model_inter_op_threads: int = 1
|
|
model_intra_op_threads: int = 2
|
|
|
|
class Config:
|
|
env_prefix = "MACHINE_LEARNING_"
|
|
case_sensitive = False
|
|
|
|
|
|
_clean_name = str.maketrans(":\\/", "___", ".")
|
|
|
|
|
|
def get_cache_dir(model_name: str, model_type: ModelType) -> Path:
|
|
return Path(settings.cache_folder) / model_type.value / model_name.translate(_clean_name)
|
|
|
|
|
|
settings = Settings()
|