Spaces:
Build error
Build error
π Add custom cache directory
Browse files- app.py +6 -3
- cache/.gitkeep +0 -0
app.py
CHANGED
|
@@ -23,13 +23,15 @@ def main():
|
|
| 23 |
controlnet_tile = ControlNetModel.from_pretrained(
|
| 24 |
"lllyasviel/control_v11f1e_sd15_tile",
|
| 25 |
torch_dtype=torch.float16,
|
| 26 |
-
use_safetensors=False
|
|
|
|
| 27 |
).to(device)
|
| 28 |
|
| 29 |
controlnet_brightness = ControlNetModel.from_pretrained(
|
| 30 |
"ioclab/control_v1p_sd15_brightness",
|
| 31 |
torch_dtype=torch.float16,
|
| 32 |
-
use_safetensors=True
|
|
|
|
| 33 |
).to(device)
|
| 34 |
|
| 35 |
def make_pipe(hf_repo: str, device: str) -> StableDiffusionControlNetPipeline:
|
|
@@ -37,6 +39,7 @@ def main():
|
|
| 37 |
hf_repo,
|
| 38 |
controlnet=[controlnet_tile, controlnet_brightness],
|
| 39 |
torch_dtype=torch.float16,
|
|
|
|
| 40 |
)
|
| 41 |
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
| 42 |
# pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|
|
@@ -71,7 +74,7 @@ def main():
|
|
| 71 |
controlnet_conditioning_brightness: float = 0.45,
|
| 72 |
seed: int = 1331,
|
| 73 |
) -> PilImage:
|
| 74 |
-
generator = torch.Generator(device
|
| 75 |
if model == "DreamShaper":
|
| 76 |
pipe = move_pipe("DreamShaper")
|
| 77 |
# elif model == "Realistic Vision V1.4":
|
|
|
|
| 23 |
controlnet_tile = ControlNetModel.from_pretrained(
|
| 24 |
"lllyasviel/control_v11f1e_sd15_tile",
|
| 25 |
torch_dtype=torch.float16,
|
| 26 |
+
use_safetensors=False,
|
| 27 |
+
cache_dir="./cache"
|
| 28 |
).to(device)
|
| 29 |
|
| 30 |
controlnet_brightness = ControlNetModel.from_pretrained(
|
| 31 |
"ioclab/control_v1p_sd15_brightness",
|
| 32 |
torch_dtype=torch.float16,
|
| 33 |
+
use_safetensors=True,
|
| 34 |
+
cache_dir="./cache"
|
| 35 |
).to(device)
|
| 36 |
|
| 37 |
def make_pipe(hf_repo: str, device: str) -> StableDiffusionControlNetPipeline:
|
|
|
|
| 39 |
hf_repo,
|
| 40 |
controlnet=[controlnet_tile, controlnet_brightness],
|
| 41 |
torch_dtype=torch.float16,
|
| 42 |
+
cache_dir="./cache",
|
| 43 |
)
|
| 44 |
pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config)
|
| 45 |
# pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|
|
|
|
| 74 |
controlnet_conditioning_brightness: float = 0.45,
|
| 75 |
seed: int = 1331,
|
| 76 |
) -> PilImage:
|
| 77 |
+
generator = torch.Generator(device).manual_seed(seed)
|
| 78 |
if model == "DreamShaper":
|
| 79 |
pipe = move_pipe("DreamShaper")
|
| 80 |
# elif model == "Realistic Vision V1.4":
|
cache/.gitkeep
ADDED
|
File without changes
|