Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -144,7 +144,16 @@ def generate_image_from_text(pos_prompt, seed):
|
|
144 |
response_body = json.loads(response.get('body').read())
|
145 |
base64_image_data = base64.b64decode(response_body['images'][0])
|
146 |
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
def check_input_image(input_image):
|
150 |
if input_image is None:
|
|
|
144 |
response_body = json.loads(response.get('body').read())
|
145 |
base64_image_data = base64.b64decode(response_body['images'][0])
|
146 |
|
147 |
+
image = Image.open(io.BytesIO(base64_image_data))
|
148 |
+
|
149 |
+
|
150 |
+
webp_image_io = io.BytesIO()
|
151 |
+
image = image.convert('RGB') # Convert to RGB for WebP compatibility
|
152 |
+
image.save(webp_image_io, format='WEBP')
|
153 |
+
|
154 |
+
webp_image_io.seek(0)
|
155 |
+
|
156 |
+
return Image.open(webp_image_io)
|
157 |
|
158 |
def check_input_image(input_image):
|
159 |
if input_image is None:
|