Change how we read the png image
Browse files- handler.py +1 -3
handler.py
CHANGED
@@ -2,7 +2,6 @@ from typing import Dict, List, Any
|
|
2 |
import torch
|
3 |
import requests
|
4 |
from PIL import Image
|
5 |
-
from io import BytesIO
|
6 |
from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline, DDIMScheduler
|
7 |
|
8 |
# set device
|
@@ -35,8 +34,7 @@ class EndpointHandler():
|
|
35 |
"""
|
36 |
prompt = data.pop("inputs", data)
|
37 |
url = data.pop("url", data)
|
38 |
-
|
39 |
-
init_image = Image.open(BytesIO(response.content)).convert("RGB")
|
40 |
init_image.thumbnail((512, 512))
|
41 |
|
42 |
params = data.pop("parameters", data)
|
|
|
2 |
import torch
|
3 |
import requests
|
4 |
from PIL import Image
|
|
|
5 |
from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline, DDIMScheduler
|
6 |
|
7 |
# set device
|
|
|
34 |
"""
|
35 |
prompt = data.pop("inputs", data)
|
36 |
url = data.pop("url", data)
|
37 |
+
init_image = Image.open(url.convert("RGB")
|
|
|
38 |
init_image.thumbnail((512, 512))
|
39 |
|
40 |
params = data.pop("parameters", data)
|