asoderznik
commited on
Commit
•
d70b1c6
1
Parent(s):
2c83deb
ad PIL import
Browse files- handler.py +3 -1
handler.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
from typing import Dict, List, Any
|
|
|
2 |
import torch
|
3 |
from torch import autocast
|
4 |
from diffusers import StableDiffusionPipeline
|
@@ -29,7 +30,8 @@ class EndpointHandler():
|
|
29 |
"""
|
30 |
inputs = data.pop("inputs", data)
|
31 |
# decode base64 image to PIL
|
32 |
-
image = Image.open(BytesIO(base64.b64decode(inputs['image'])))
|
|
|
33 |
|
34 |
# run inference pipeline
|
35 |
#with autocast(device.type):
|
|
|
1 |
from typing import Dict, List, Any
|
2 |
+
from PIL import Image
|
3 |
import torch
|
4 |
from torch import autocast
|
5 |
from diffusers import StableDiffusionPipeline
|
|
|
30 |
"""
|
31 |
inputs = data.pop("inputs", data)
|
32 |
# decode base64 image to PIL
|
33 |
+
#image = Image.open(BytesIO(base64.b64decode(inputs['image'])))
|
34 |
+
image = Image.open(BytesIO(inputs['image'])).convert("RGB")
|
35 |
|
36 |
# run inference pipeline
|
37 |
#with autocast(device.type):
|