Spaces:
Running
Running
fix: image processing logic for PIL Image input
Browse files🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
app.py
CHANGED
|
@@ -93,6 +93,9 @@ def process_image(image, ocr_type="ocr", ocr_box="", ocr_color=""):
|
|
| 93 |
image = image.split(',')[1]
|
| 94 |
image_data = base64.b64decode(image)
|
| 95 |
image = Image.open(io.BytesIO(image_data))
|
|
|
|
|
|
|
|
|
|
| 96 |
|
| 97 |
# PIL ImageをRGB形式に変換
|
| 98 |
if image.mode != 'RGB':
|
|
|
|
| 93 |
image = image.split(',')[1]
|
| 94 |
image_data = base64.b64decode(image)
|
| 95 |
image = Image.open(io.BytesIO(image_data))
|
| 96 |
+
elif not isinstance(image, Image.Image):
|
| 97 |
+
# その他の形式の場合はPIL Imageに変換
|
| 98 |
+
image = Image.open(image)
|
| 99 |
|
| 100 |
# PIL ImageをRGB形式に変換
|
| 101 |
if image.mode != 'RGB':
|