Files
AiDA_Python/app/core/config.py

74 lines
1.8 KiB
Python
Raw Normal View History

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')
settings = Settings()
ckpt = 'service/super_resolution_ccsr/weights/real-world_ccsr.ckpt'
config = 'service/super_resolution_ccsr/configs/model/ccsr_stage2.yaml'
steps = 45
sr_scale = 4
repeat_times = 1
tiled = False
tile_size = 512
tile_stride = 256
color_fix_type = "adain"
t_max = 0.6667
t_min = 0.3333
show_lq = False
skip_if_exist = False
seed = 233
device = "cuda"
tile_diffusion = False #
tile_diffusion_size = 512
tile_diffusion_stride = 256
tile_vae = True
vae_decoder_tile_size = 224
vae_encoder_tile_size = 1024
strength = 1
# minio 配置
sr_bucket = "test"
MINIO_IP = "www.minio.aida.com.hk"
MINIO_PORT = 9000
MINIO_ACCESS = 'vXKFLSJkYeEq2DrSZvkB'
MINIO_SECRET = 'uKTZT3x7C43WvPN9QTc99DiRkwddWZrG9Uh3JVlR'
2024-03-21 11:12:01 +08:00
# redis 配置
REDIS_HOST = "10.1.1.240"
REDIS_PORT = "6379"
REDIS_DB = "2"
2024-03-20 11:44:15 +08:00
MINIO_SECURE = True
2024-03-21 11:24:46 +08:00
LOGS_PATH = "app/logs/errors.log"
# LOGS_PATH = "logs/errors.log"
2024-03-21 11:12:01 +08:00
SR_MODEL_NAME = "super_resolution"
# 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-03-26 11:51:31 +08:00
RABBITMQ_QUEUES = os.getenv("RABBITMQ_QUEUES", "SuperResolution-local")