Mirza Učanbarlić
commited on
Commit
·
71ffd5c
1
Parent(s):
5373874
fix load image
Browse files- handler.py +5 -1
handler.py
CHANGED
|
@@ -5,6 +5,7 @@ import base64
|
|
| 5 |
from io import BytesIO
|
| 6 |
from pathlib import Path
|
| 7 |
import os
|
|
|
|
| 8 |
|
| 9 |
class EndpointHandler():
|
| 10 |
def __init__(self, path=""):
|
|
@@ -22,9 +23,12 @@ class EndpointHandler():
|
|
| 22 |
Return:
|
| 23 |
A :obj:`list` | `dict`: will be serialized and returned
|
| 24 |
"""
|
| 25 |
-
|
| 26 |
prompt = data.pop("prompt", None)
|
| 27 |
|
|
|
|
|
|
|
|
|
|
| 28 |
# run normal prediction
|
| 29 |
output = self.pipeline(prompt=prompt, image=input_image)
|
| 30 |
|
|
|
|
| 5 |
from io import BytesIO
|
| 6 |
from pathlib import Path
|
| 7 |
import os
|
| 8 |
+
from diffusers.utils import load_image
|
| 9 |
|
| 10 |
class EndpointHandler():
|
| 11 |
def __init__(self, path=""):
|
|
|
|
| 23 |
Return:
|
| 24 |
A :obj:`list` | `dict`: will be serialized and returned
|
| 25 |
"""
|
| 26 |
+
input_image_url = data.pop("input_image", data)
|
| 27 |
prompt = data.pop("prompt", None)
|
| 28 |
|
| 29 |
+
#load image
|
| 30 |
+
input_image = load_image(input_image_url)
|
| 31 |
+
|
| 32 |
# run normal prediction
|
| 33 |
output = self.pipeline(prompt=prompt, image=input_image)
|
| 34 |
|