Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -73,7 +73,12 @@ def generate_image(prompt):
|
|
73 |
|
74 |
if isinstance(result, tuple) and len(result) > 0 and isinstance(result[0], str):
|
75 |
img_str = result[0]
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
77 |
img_data = base64.b64decode(img_str)
|
78 |
image = PILImage.open(BytesIO(img_data))
|
79 |
elif isinstance(result, tuple) and len(result) > 0 and isinstance(result[0], np.ndarray):
|
|
|
73 |
|
74 |
if isinstance(result, tuple) and len(result) > 0 and isinstance(result[0], str):
|
75 |
img_str = result[0]
|
76 |
+
|
77 |
+
# Fix padding if necessary
|
78 |
+
missing_padding = len(img_str) % 4
|
79 |
+
if missing_padding:
|
80 |
+
img_str += '=' * (4 - missing_padding)
|
81 |
+
|
82 |
img_data = base64.b64decode(img_str)
|
83 |
image = PILImage.open(BytesIO(img_data))
|
84 |
elif isinstance(result, tuple) and len(result) > 0 and isinstance(result[0], np.ndarray):
|