Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,13 +6,13 @@ import json
|
|
| 6 |
|
| 7 |
def process(json_input):
|
| 8 |
try:
|
| 9 |
-
|
|
|
|
| 10 |
|
| 11 |
-
# Base64 → PIL Image
|
| 12 |
img_bytes = base64.b64decode(data["image_b64"])
|
| 13 |
img = Image.open(io.BytesIO(img_bytes))
|
| 14 |
|
| 15 |
-
return img #
|
| 16 |
|
| 17 |
except Exception as e:
|
| 18 |
return None
|
|
|
|
| 6 |
|
| 7 |
def process(json_input):
|
| 8 |
try:
|
| 9 |
+
# json_input from gr.JSON() is STRING, so must parse
|
| 10 |
+
data = json.loads(json_input)
|
| 11 |
|
|
|
|
| 12 |
img_bytes = base64.b64decode(data["image_b64"])
|
| 13 |
img = Image.open(io.BytesIO(img_bytes))
|
| 14 |
|
| 15 |
+
return img # show image
|
| 16 |
|
| 17 |
except Exception as e:
|
| 18 |
return None
|