Spaces:
Running on Zero
Running on Zero
| """Presets for texture generation.""" | |
| from typing import Dict, Any | |
| # Preset definitions with optimized prompts and parameters | |
| TEXTURE_PRESETS: Dict[str, Dict[str, Any]] = { | |
| "Wood Texture": { | |
| "prompt": "seamless wood texture, natural grain, high detail, tiling pattern", | |
| "negative_prompt": "blurry, low quality, distorted", | |
| "guidance_scale": 7.5, | |
| "num_inference_steps": 50, | |
| "width": 1024, | |
| "height": 1024, | |
| }, | |
| "Fabric Texture": { | |
| "prompt": "seamless fabric texture, woven material, soft surface, repeating pattern", | |
| "negative_prompt": "hard surface, metal, plastic", | |
| "guidance_scale": 7.5, | |
| "num_inference_steps": 50, | |
| "width": 1024, | |
| "height": 1024, | |
| }, | |
| "Metal Texture": { | |
| "prompt": "seamless metal texture, brushed steel, reflective surface, industrial", | |
| "negative_prompt": "soft, fabric, organic", | |
| "guidance_scale": 8.0, | |
| "num_inference_steps": 60, | |
| "width": 1024, | |
| "height": 1024, | |
| }, | |
| "Stone Texture": { | |
| "prompt": "seamless stone texture, natural rock surface, rough texture, tiling", | |
| "negative_prompt": "smooth, polished, artificial", | |
| "guidance_scale": 7.5, | |
| "num_inference_steps": 50, | |
| "width": 1024, | |
| "height": 1024, | |
| }, | |
| "Brick Texture": { | |
| "prompt": "seamless brick texture, red bricks, mortar lines, repeating pattern", | |
| "negative_prompt": "smooth, uniform, painted", | |
| "guidance_scale": 7.5, | |
| "num_inference_steps": 50, | |
| "width": 1024, | |
| "height": 1024, | |
| }, | |
| "Leather Texture": { | |
| "prompt": "seamless leather texture, natural grain, soft surface, high detail", | |
| "negative_prompt": "synthetic, plastic, smooth", | |
| "guidance_scale": 7.5, | |
| "num_inference_steps": 50, | |
| "width": 1024, | |
| "height": 1024, | |
| }, | |
| "Concrete Texture": { | |
| "prompt": "seamless concrete texture, rough surface, industrial, tiling pattern", | |
| "negative_prompt": "smooth, polished, painted", | |
| "guidance_scale": 7.5, | |
| "num_inference_steps": 50, | |
| "width": 1024, | |
| "height": 1024, | |
| }, | |
| "Marble Texture": { | |
| "prompt": "seamless marble texture, natural veins, polished surface, elegant", | |
| "negative_prompt": "rough, matte, artificial", | |
| "guidance_scale": 8.0, | |
| "num_inference_steps": 60, | |
| "width": 1024, | |
| "height": 1024, | |
| }, | |
| } | |
| def get_preset(name: str) -> Dict[str, Any] | None: | |
| """Get a preset by name. | |
| Args: | |
| name: Name of the preset. | |
| Returns: | |
| Preset dictionary or None if not found. | |
| """ | |
| return TEXTURE_PRESETS.get(name) | |
| def list_presets() -> list[str]: | |
| """List all available preset names. | |
| Returns: | |
| List of preset names. | |
| """ | |
| return list(TEXTURE_PRESETS.keys()) | |
| def get_preset_prompt(name: str) -> str | None: | |
| """Get the prompt for a preset. | |
| Args: | |
| name: Name of the preset. | |
| Returns: | |
| Prompt string or None if preset not found. | |
| """ | |
| preset = get_preset(name) | |
| return preset.get("prompt") if preset else None | |
| def get_preset_params(name: str) -> Dict[str, Any] | None: | |
| """Get parameters for a preset (excluding prompt). | |
| Args: | |
| name: Name of the preset. | |
| Returns: | |
| Dictionary of parameters or None if preset not found. | |
| """ | |
| preset = get_preset(name) | |
| if not preset: | |
| return None | |
| # Return all params except prompt | |
| params = preset.copy() | |
| params.pop("prompt", None) | |
| return params | |