jonathanpark
commited on
Commit
•
ca2f7e7
1
Parent(s):
f37021f
url correct
Browse files- handler.py +4 -1
handler.py
CHANGED
@@ -2,6 +2,7 @@ from typing import Dict, List, Any
|
|
2 |
import torch
|
3 |
from PIL import Image
|
4 |
from io import BytesIO
|
|
|
5 |
from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline, DDIMScheduler
|
6 |
|
7 |
# set device
|
@@ -34,7 +35,9 @@ class EndpointHandler():
|
|
34 |
"""
|
35 |
prompt = data.pop("inputs", data)
|
36 |
url = data.pop("url", data)
|
37 |
-
|
|
|
|
|
38 |
init_image.thumbnail((512, 512))
|
39 |
|
40 |
|
|
|
2 |
import torch
|
3 |
from PIL import Image
|
4 |
from io import BytesIO
|
5 |
+
import requests
|
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 |
+
|
39 |
+
response = requests.get(url)
|
40 |
+
init_image = Image.open(BytesIO(response.content)).convert("RGB")
|
41 |
init_image.thumbnail((512, 512))
|
42 |
|
43 |
|