Spaces:
Running on Zero
Running on Zero
File size: 3,657 Bytes
f0d9a3e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | """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
|