Spaces:
Runtime error
Runtime error
| """ | |
| Configuration file for FLUX Kontext Style Transfer Space | |
| """ | |
| import os | |
| # Model configuration | |
| BASE_MODEL_ID = "black-forest-labs/FLUX.1-Kontext-dev" | |
| LORA_REPO_ID = "Owen777/Kontext-Style-Loras" | |
| # Default generation parameters | |
| DEFAULT_INFERENCE_STEPS = 24 | |
| DEFAULT_GUIDANCE_SCALE = 7.5 | |
| DEFAULT_LORA_STRENGTH = 1.0 | |
| DEFAULT_WIDTH = 1024 | |
| DEFAULT_HEIGHT = 1024 | |
| # GPU and memory settings | |
| USE_TORCH_COMPILE = False # Set to True if you want to use torch.compile for faster inference | |
| ENABLE_CPU_OFFLOAD = True # Enable CPU offloading to save GPU memory | |
| LOW_VRAM_MODE = False # Set to True for systems with limited VRAM | |
| # Gradio configuration | |
| GRADIO_SHARE = False | |
| GRADIO_DEBUG = False | |
| GRADIO_ENABLE_QUEUE = True | |
| MAX_QUEUE_SIZE = 20 | |
| # Cache settings | |
| CACHE_DIR = "./cache" | |
| LORA_CACHE_DIR = "./LoRAs" | |
| # Security settings | |
| MAX_IMAGE_SIZE = 2048 # Maximum image dimension | |
| MIN_IMAGE_SIZE = 256 # Minimum image dimension | |
| MAX_BATCH_SIZE = 1 # Maximum number of images to process at once | |
| # Hugging Face settings | |
| HF_TOKEN = os.getenv("HF_TOKEN", None) # Optional: Set if you need authentication | |
| # Style configuration with descriptions | |
| STYLE_DESCRIPTIONS = { | |
| "3D_Chibi": "Transform images into cute 3D chibi character style", | |
| "American_Cartoon": "Apply classic American cartoon aesthetics", | |
| "Chinese_Ink": "Convert to traditional Chinese ink painting style", | |
| "Clay_Toy": "Give images a clay toy/sculpture appearance", | |
| "Fabric": "Apply textile and fabric texture effects", | |
| "Ghibli": "Transform into Studio Ghibli anime style", | |
| "Irasutoya": "Apply Japanese Irasutoya illustration style", | |
| "Jojo": "Convert to JoJo's Bizarre Adventure anime style", | |
| "Oil_Painting": "Apply classic oil painting techniques", | |
| "Pixel": "Transform into retro pixel art style", | |
| "Snoopy": "Apply Peanuts comic strip style", | |
| "Poly": "Convert to low-poly 3D art style", | |
| "LEGO": "Transform into LEGO brick construction style", | |
| "Origami": "Apply paper folding origami art style", | |
| "Pop_Art": "Convert to pop art movement style", | |
| "Van_Gogh": "Apply Van Gogh's distinctive painting style", | |
| "Paper_Cutting": "Transform using paper cutting art technique", | |
| "Line": "Convert to clean line art style", | |
| "Vector": "Apply vector graphics style", | |
| "Picasso": "Transform using Picasso's cubist style", | |
| "Macaron": "Apply soft pastel macaron color palette", | |
| "Rick_Morty": "Convert to Rick and Morty cartoon style" | |
| } | |
| # Example images for demonstration | |
| EXAMPLE_IMAGES = [ | |
| "https://huggingface.co/datasets/black-forest-labs/kontext-bench/resolve/main/test/images/0003.jpg", | |
| # Add more example image URLs here if needed | |
| ] | |