Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -61,6 +61,11 @@ def generate(
|
|
| 61 |
):
|
| 62 |
if torch.cuda.is_available():
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
if not use_vae:
|
| 65 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(model, torch_dtype=torch.float16)
|
| 66 |
|
|
@@ -71,11 +76,6 @@ def generate(
|
|
| 71 |
if use_lora:
|
| 72 |
pipe.load_lora_weights(lora)
|
| 73 |
pipe.fuse_lora(lora_scale=0.7)
|
| 74 |
-
|
| 75 |
-
url = "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"
|
| 76 |
-
response = requests.get(url)
|
| 77 |
-
init_image = Image.open(BytesIO(response.content))
|
| 78 |
-
init_image = init_image.resize((1024, 1024))
|
| 79 |
|
| 80 |
if ENABLE_CPU_OFFLOAD:
|
| 81 |
pipe.enable_model_cpu_offload()
|
|
|
|
| 61 |
):
|
| 62 |
if torch.cuda.is_available():
|
| 63 |
|
| 64 |
+
url = "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"
|
| 65 |
+
response = requests.get(url)
|
| 66 |
+
init_image = Image.open(BytesIO(response.content))
|
| 67 |
+
init_image = init_image.resize((1024, 1024))
|
| 68 |
+
|
| 69 |
if not use_vae:
|
| 70 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(model, torch_dtype=torch.float16)
|
| 71 |
|
|
|
|
| 76 |
if use_lora:
|
| 77 |
pipe.load_lora_weights(lora)
|
| 78 |
pipe.fuse_lora(lora_scale=0.7)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
if ENABLE_CPU_OFFLOAD:
|
| 81 |
pipe.enable_model_cpu_offload()
|