2024-03-20 11:44:15 +08:00
|
|
|
import os
|
2024-03-21 11:12:01 +08:00
|
|
|
|
|
|
|
|
import pika
|
2024-03-20 11:44:15 +08:00
|
|
|
from dotenv import load_dotenv
|
|
|
|
|
from pydantic import BaseSettings
|
|
|
|
|
|
|
|
|
|
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../'))
|
|
|
|
|
load_dotenv(os.path.join(BASE_DIR, '.env'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
|
|
|
PROJECT_NAME = os.getenv('PROJECT_NAME', 'FASTAPI BASE')
|
|
|
|
|
SECRET_KEY = os.getenv('SECRET_KEY', '')
|
|
|
|
|
API_PREFIX = ''
|
|
|
|
|
BACKEND_CORS_ORIGINS = ['*']
|
|
|
|
|
DATABASE_URL = os.getenv('SQL_DATABASE_URL', '')
|
|
|
|
|
ACCESS_TOKEN_EXPIRE_SECONDS: int = 60 * 60 * 24 * 7 # Token expired after 7 days
|
|
|
|
|
SECURITY_ALGORITHM = 'HS256'
|
|
|
|
|
LOGGING_CONFIG_FILE = os.path.join(BASE_DIR, 'logging_env.py')
|
|
|
|
|
|
|
|
|
|
|
2024-04-23 15:00:08 +08:00
|
|
|
DEBUG = False
|
2024-04-15 18:07:25 +08:00
|
|
|
if DEBUG:
|
2024-04-16 15:51:03 +08:00
|
|
|
LOGS_PATH = "logs/"
|
|
|
|
|
CATEGORY_PATH = "service/attribute/config/descriptor/category/category_dis.csv"
|
2024-04-26 14:54:28 +08:00
|
|
|
FACE_CLASSIFIER = "service/generate_image/utils/haarcascade_frontalface_alt.xml"
|
2024-04-15 18:07:25 +08:00
|
|
|
else:
|
2024-04-16 15:51:03 +08:00
|
|
|
LOGS_PATH = "app/logs/"
|
|
|
|
|
CATEGORY_PATH = "app/service/attribute/config/descriptor/category/category_dis.csv"
|
2024-04-26 14:54:28 +08:00
|
|
|
FACE_CLASSIFIER = 'app/service/generate_image/utils/haarcascade_frontalface_alt.xml'
|
2024-04-15 18:07:25 +08:00
|
|
|
|
2024-04-15 18:41:49 +08:00
|
|
|
# RABBITMQ_ENV = "" # 生产环境
|
2024-04-22 11:44:17 +08:00
|
|
|
# RABBITMQ_ENV = "-dev" # 开发环境
|
|
|
|
|
RABBITMQ_ENV = "-local" # 本地测试环境
|
2024-04-15 18:07:25 +08:00
|
|
|
|
2024-03-20 11:44:15 +08:00
|
|
|
settings = Settings()
|
|
|
|
|
|
|
|
|
|
# minio 配置
|
2024-04-16 15:51:03 +08:00
|
|
|
MINIO_URL = "www.minio.aida.com.hk:9000"
|
2024-03-20 11:44:15 +08:00
|
|
|
MINIO_ACCESS = 'vXKFLSJkYeEq2DrSZvkB'
|
|
|
|
|
MINIO_SECRET = 'uKTZT3x7C43WvPN9QTc99DiRkwddWZrG9Uh3JVlR'
|
2024-04-15 18:07:25 +08:00
|
|
|
MINIO_SECURE = True
|
2024-03-21 11:12:01 +08:00
|
|
|
|
|
|
|
|
# redis 配置
|
|
|
|
|
REDIS_HOST = "10.1.1.240"
|
|
|
|
|
REDIS_PORT = "6379"
|
|
|
|
|
REDIS_DB = "2"
|
|
|
|
|
|
|
|
|
|
# rabbitmq config
|
|
|
|
|
RABBITMQ_PARAMS = {
|
|
|
|
|
"host": "18.167.251.121",
|
|
|
|
|
"port": 5672,
|
|
|
|
|
"credentials": pika.credentials.PlainCredentials(username='rabbit', password='123456'),
|
|
|
|
|
"virtual_host": "/"
|
|
|
|
|
}
|
2024-03-26 11:34:54 +08:00
|
|
|
|
2024-04-16 15:51:03 +08:00
|
|
|
# attribute service config
|
|
|
|
|
ATT_TRITON_URL = "10.1.1.240:8020"
|
|
|
|
|
|
2024-04-15 18:07:25 +08:00
|
|
|
# SR service config
|
|
|
|
|
SR_MODEL_NAME = "super_resolution"
|
|
|
|
|
SR_TRITON_URL = "10.1.1.240:10031"
|
2024-04-15 18:26:48 +08:00
|
|
|
SR_MINIO_BUCKET = "aida-users"
|
2024-04-16 15:51:03 +08:00
|
|
|
SR_RABBITMQ_QUEUES = os.getenv("SR_RABBITMQ_QUEUES", f"SuperResolution{RABBITMQ_ENV}")
|
2024-04-15 18:07:25 +08:00
|
|
|
|
|
|
|
|
# GenerateImage service config
|
2024-04-16 15:51:03 +08:00
|
|
|
GI_MODEL_NAME = 'stable_diffusion_xl_lcm'
|
|
|
|
|
GI_MODEL_URL = '10.1.1.150:8001'
|
2024-04-15 18:26:48 +08:00
|
|
|
GI_MINIO_BUCKET = "aida-users"
|
2024-04-15 18:39:07 +08:00
|
|
|
GI_RABBITMQ_QUEUES = os.getenv("GI_RABBITMQ_QUEUES", f"GenerateImage{RABBITMQ_ENV}")
|
2024-04-23 14:59:47 +08:00
|
|
|
GI_SYS_IMAGE_URL = "aida-sys-image/generate_image/white_image.jpg"
|
2024-04-15 18:07:25 +08:00
|
|
|
|
|
|
|
|
# SEG service config
|
|
|
|
|
SEG_MODEL_URL = '10.1.1.240:10000'
|
|
|
|
|
SEGMENTATION = {
|
|
|
|
|
"name": "seg_ocrnet_hr18",
|
|
|
|
|
"input": "seg_input__0",
|
|
|
|
|
"output": "seg_output__0",
|
|
|
|
|
}
|