Spaces:
Runtime error
Runtime error
convert image to RGB
Browse files
main.py
CHANGED
@@ -34,7 +34,7 @@ async def ApplyOCR(file: UploadFile):
|
|
34 |
try:
|
35 |
# Read the uploaded image file
|
36 |
contents = await file.read()
|
37 |
-
image = Image.open(io.BytesIO(contents))
|
38 |
|
39 |
pixel_values = config['processor'](image, return_tensors="pt").pixel_values
|
40 |
generated_ids = config['ocr_model'].generate(pixel_values)
|
|
|
34 |
try:
|
35 |
# Read the uploaded image file
|
36 |
contents = await file.read()
|
37 |
+
image = Image.open(io.BytesIO(contents)).convert("RGB")
|
38 |
|
39 |
pixel_values = config['processor'](image, return_tensors="pt").pixel_values
|
40 |
generated_ids = config['ocr_model'].generate(pixel_values)
|