Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -31,6 +31,8 @@ async def donut_question_answering(
|
|
31 |
# Open the image using PIL
|
32 |
image = Image.open(BytesIO(contents))
|
33 |
|
|
|
|
|
34 |
# Split the questions into a list
|
35 |
question_list = questions.split(',')
|
36 |
|
@@ -45,6 +47,8 @@ async def donut_question_answering(
|
|
45 |
return {"error": f"Error processing file: {str(e)}"}
|
46 |
|
47 |
def process_document(image, questions):
|
|
|
|
|
48 |
# prepare encoder inputs
|
49 |
pixel_values = processor(image, return_tensors="pt").pixel_values
|
50 |
|
|
|
31 |
# Open the image using PIL
|
32 |
image = Image.open(BytesIO(contents))
|
33 |
|
34 |
+
image = image.convert("RGB")
|
35 |
+
|
36 |
# Split the questions into a list
|
37 |
question_list = questions.split(',')
|
38 |
|
|
|
47 |
return {"error": f"Error processing file: {str(e)}"}
|
48 |
|
49 |
def process_document(image, questions):
|
50 |
+
image = image.convert("RGB")
|
51 |
+
|
52 |
# prepare encoder inputs
|
53 |
pixel_values = processor(image, return_tensors="pt").pixel_values
|
54 |
|