Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -61,8 +61,12 @@ def generate(
|
|
61 |
if not use_vae:
|
62 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
|
63 |
response = requests.get(url)
|
|
|
|
|
64 |
init_image = Image.open(BytesIO(response.content)).convert("RGB")
|
65 |
init_image = init_image.resize((768, 512))
|
|
|
|
|
66 |
|
67 |
if use_vae:
|
68 |
vae = AutoencoderKL.from_pretrained(vaecall, torch_dtype=torch.float16)
|
|
|
61 |
if not use_vae:
|
62 |
pipe = StableDiffusionImg2ImgPipeline.from_pretrained("runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16)
|
63 |
response = requests.get(url)
|
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)
|