Update modeling_deepseekocr.py
Browse files- modeling_deepseekocr.py +1 -6
modeling_deepseekocr.py
CHANGED
|
@@ -27,11 +27,6 @@ import time
|
|
| 27 |
def load_image(image_path):
|
| 28 |
|
| 29 |
try:
|
| 30 |
-
#dummy_img = Image.new("RGB", (640, 640), color="white")
|
| 31 |
-
#ioBuff = BytesIO()
|
| 32 |
-
#dummy_img.save(ioBuff, format="PNG")
|
| 33 |
-
#ioBuff.seek(0)
|
| 34 |
-
#image = Image.open(ioBuff)
|
| 35 |
print(f"image_path:",type(image_path))
|
| 36 |
image = Image.open(image_path)
|
| 37 |
|
|
@@ -723,7 +718,7 @@ class DeepseekOCRForCausalLM(DeepseekV2ForCausalLM):
|
|
| 723 |
# "content": "<image>\nFree OCR. ",
|
| 724 |
# "content": "<image>\nParse the figure. ",
|
| 725 |
# "content": "<image>\nExtract the text in the image. ",
|
| 726 |
-
"images": [f'{image_file}'],
|
| 727 |
},
|
| 728 |
{"role": "<|Assistant|>", "content": ""},
|
| 729 |
]
|
|
|
|
| 27 |
def load_image(image_path):
|
| 28 |
|
| 29 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
print(f"image_path:",type(image_path))
|
| 31 |
image = Image.open(image_path)
|
| 32 |
|
|
|
|
| 718 |
# "content": "<image>\nFree OCR. ",
|
| 719 |
# "content": "<image>\nParse the figure. ",
|
| 720 |
# "content": "<image>\nExtract the text in the image. ",
|
| 721 |
+
"images": [image_file] if isinstance(image_file, BytesIO) else [f'{image_file}'],
|
| 722 |
},
|
| 723 |
{"role": "<|Assistant|>", "content": ""},
|
| 724 |
]
|