Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -86,7 +86,10 @@ def convert_image():
|
|
| 86 |
base64_string = data['file']
|
| 87 |
if base64_string.startswith('data:image'):
|
| 88 |
base64_string = base64_string.split(',')[1]
|
| 89 |
-
|
|
|
|
|
|
|
|
|
|
| 90 |
image = Image.open(io.BytesIO(image_data)).convert('RGB')
|
| 91 |
|
| 92 |
# Get parameters (with defaults)
|
|
|
|
| 86 |
base64_string = data['file']
|
| 87 |
if base64_string.startswith('data:image'):
|
| 88 |
base64_string = base64_string.split(',')[1]
|
| 89 |
+
try:
|
| 90 |
+
image_data = base64.b64decode(base64_string)
|
| 91 |
+
except Exception as e:
|
| 92 |
+
return jsonify({'error': 'Invalid base64 image data'}), 400
|
| 93 |
image = Image.open(io.BytesIO(image_data)).convert('RGB')
|
| 94 |
|
| 95 |
# Get parameters (with defaults)
|