Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,13 +58,9 @@ def generate(
|
|
| 58 |
vaecall = 'stabilityai/sd-vae-ft-mse',
|
| 59 |
lora = 'amazonaws-la/juliette',
|
| 60 |
lora_scale: float = 0.7,
|
| 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)
|
|
@@ -106,7 +102,7 @@ def generate(
|
|
| 106 |
guidance_scale=guidance_scale_base,
|
| 107 |
num_inference_steps=num_inference_steps_base,
|
| 108 |
generator=generator,
|
| 109 |
-
image=
|
| 110 |
output_type="pil",
|
| 111 |
).images[0]
|
| 112 |
else:
|
|
|
|
| 58 |
vaecall = 'stabilityai/sd-vae-ft-mse',
|
| 59 |
lora = 'amazonaws-la/juliette',
|
| 60 |
lora_scale: float = 0.7,
|
| 61 |
+
url = "https://m.media-amazon.com/images/I/81zPcrN6m+L.jpg",
|
| 62 |
+
) -> PIL.Image.Image:
|
| 63 |
if torch.cuda.is_available():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
if not use_vae:
|
| 66 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained(model, torch_dtype=torch.float16)
|
|
|
|
| 102 |
guidance_scale=guidance_scale_base,
|
| 103 |
num_inference_steps=num_inference_steps_base,
|
| 104 |
generator=generator,
|
| 105 |
+
image=url,
|
| 106 |
output_type="pil",
|
| 107 |
).images[0]
|
| 108 |
else:
|