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