Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,19 +54,14 @@ def generate(
|
|
| 54 |
vaecall = 'madebyollin/sdxl-vae-fp16-fix',
|
| 55 |
lora = '',
|
| 56 |
lora_scale: float = 0.7,
|
| 57 |
-
url = "https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg",
|
| 58 |
):
|
| 59 |
if torch.cuda.is_available():
|
| 60 |
|
| 61 |
if not use_vae:
|
| 62 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
|
| 63 |
-
response = requests.get(
|
| 64 |
-
if response.status_code != 200:
|
| 65 |
-
raise Exception(f"Failed to fetch image from URL: {url}")
|
| 66 |
init_image = Image.open(BytesIO(response.content)).convert("RGB")
|
| 67 |
init_image = init_image.resize((768, 512))
|
| 68 |
-
except Exception as e:
|
| 69 |
-
return f"Error fetching image from URL: {str(e)}"
|
| 70 |
|
| 71 |
if use_vae:
|
| 72 |
vae = AutoencoderKL.from_pretrained(vaecall, torch_dtype=torch.float16)
|
|
|
|
| 54 |
vaecall = 'madebyollin/sdxl-vae-fp16-fix',
|
| 55 |
lora = '',
|
| 56 |
lora_scale: float = 0.7,
|
|
|
|
| 57 |
):
|
| 58 |
if torch.cuda.is_available():
|
| 59 |
|
| 60 |
if not use_vae:
|
| 61 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
|
| 62 |
+
response = requests.get("https://cdn.discordapp.com/attachments/1222314000138895521/1226642687248044042/image.png")
|
|
|
|
|
|
|
| 63 |
init_image = Image.open(BytesIO(response.content)).convert("RGB")
|
| 64 |
init_image = init_image.resize((768, 512))
|
|
|
|
|
|
|
| 65 |
|
| 66 |
if use_vae:
|
| 67 |
vae = AutoencoderKL.from_pretrained(vaecall, torch_dtype=torch.float16)
|