import os import sys import json import torch # Setup Repo # Audios matcha_tts_path = os.path.join(os.getcwd(), 'tabs', 'audios', 'modules', 'CosyVoice', 'third_party', 'Matcha-TTS') cosyvoice_path = os.path.join(os.getcwd(), 'tabs', 'audios', 'modules', 'CosyVoice') sys.path.append(matcha_tts_path) sys.path.append(cosyvoice_path) # Pull latest changes for submodules os.system('git submodule update --init --recursive') # Setup ENV os.environ['HF_HOME'] = os.path.join(os.getcwd(), '.cache') os.makedirs(os.environ['HF_HOME'], exist_ok=True) # CSS css = """ @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap'); body { font-family: 'Poppins', sans-serif !important; } .center-content { text-align: center; max-width: 600px; margin: 0 auto; padding: 20px; } .center-content h1 { font-weight: 600; margin-bottom: 1rem; } .center-content p { margin-bottom: 1.5rem; } """ # Config class Config: # General SECRET_KEY = os.environ.get('SECRET_KEY', '12345678') MODEL_DOWNLOAD_DIR = os.environ.get('HF_HOME', os.environ.get('HF_HUB_CACHE', '.cache')) os.makedirs(MODEL_DOWNLOAD_DIR, exist_ok=True) # Images IMAGES_MODELS = [{"repo_id": "black-forest-labs/FLUX.1-dev", "loader": "flux", "compute_type": torch.bfloat16,}, {"repo_id": "stabilityai/stable-diffusion-xl-base-1.0", "loader": "sdxl", "compute_type": torch.float16,}] with open('data/loras/sdxl.json') as f: IMAGES_LORAS_SDXL = json.load(f) with open('data/loras/flux.json') as f: IMAGES_LORAS_FLUX = json.load(f) IMAGES_CONTROLNETS = [ { "repo_id": "xinsir/controlnet-depth-sdxl-1.0", "name": "depth_xl", "layers": ["depth"], "loader": "sdxl", "compute_type": torch.float16, }, { "repo_id": "xinsir/controlnet-canny-sdxl-1.0", "name": "canny_xl", "layers": ["canny"], "loader": "sdxl", "compute_type": torch.float16, }, { "repo_id": "xinsir/controlnet-openpose-sdxl-1.0", "name": "openpose_xl", "layers": ["pose"], "loader": "sdxl", "compute_type": torch.float16, }, { "repo_id": "xinsir/controlnet-scribble-sdxl-1.0", "name": "scribble_xl", "layers": ["scribble"], "loader": "sdxl", "compute_type": torch.float16, }, { "repo_id": "Shakker-Labs/FLUX.1-dev-ControlNet-Union-Pro", "name": "flux1_union_pro", "layers": ["canny", "tile", "depth", "blur", "pose", "gray", "low_quality"], "loader": "flux-multi", "compute_type": torch.bfloat16, } ] # Audios AUDIOS_MODELS = []