Merge pull request #869 from EdmondChuiHW/master
Browse files- marker/services/__init__.py +2 -2
- marker/services/openai.py +2 -1
- pyproject.toml +2 -2
- signatures/version1/cla.json +24 -0
marker/services/__init__.py
CHANGED
|
@@ -19,9 +19,9 @@ class BaseService:
|
|
| 19 |
int, "The maximum number of output tokens to generate."
|
| 20 |
] = None
|
| 21 |
|
| 22 |
-
def img_to_base64(self, img: PIL.Image.Image):
|
| 23 |
image_bytes = BytesIO()
|
| 24 |
-
img.save(image_bytes, format=
|
| 25 |
return base64.b64encode(image_bytes.getvalue()).decode("utf-8")
|
| 26 |
|
| 27 |
def process_images(self, images: List[PIL.Image.Image]) -> list:
|
|
|
|
| 19 |
int, "The maximum number of output tokens to generate."
|
| 20 |
] = None
|
| 21 |
|
| 22 |
+
def img_to_base64(self, img: PIL.Image.Image, format: str = "WEBP"):
|
| 23 |
image_bytes = BytesIO()
|
| 24 |
+
img.save(image_bytes, format=format)
|
| 25 |
return base64.b64encode(image_bytes.getvalue()).decode("utf-8")
|
| 26 |
|
| 27 |
def process_images(self, images: List[PIL.Image.Image]) -> list:
|
marker/services/openai.py
CHANGED
|
@@ -45,12 +45,13 @@ class OpenAIService(BaseService):
|
|
| 45 |
if isinstance(images, Image.Image):
|
| 46 |
images = [images]
|
| 47 |
|
|
|
|
| 48 |
return [
|
| 49 |
{
|
| 50 |
"type": "image_url",
|
| 51 |
"image_url": {
|
| 52 |
"url": "data:image/{};base64,{}".format(
|
| 53 |
-
|
| 54 |
),
|
| 55 |
},
|
| 56 |
}
|
|
|
|
| 45 |
if isinstance(images, Image.Image):
|
| 46 |
images = [images]
|
| 47 |
|
| 48 |
+
img_fmt = self.openai_image_format
|
| 49 |
return [
|
| 50 |
{
|
| 51 |
"type": "image_url",
|
| 52 |
"image_url": {
|
| 53 |
"url": "data:image/{};base64,{}".format(
|
| 54 |
+
img_fmt, self.img_to_base64(img, format=img_fmt)
|
| 55 |
),
|
| 56 |
},
|
| 57 |
}
|
pyproject.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
[tool.poetry]
|
| 2 |
name = "marker-pdf"
|
| 3 |
-
version = "1.9.
|
| 4 |
description = "Convert documents to markdown with high speed and accuracy."
|
| 5 |
authors = ["Vik Paruchuri <github@vikas.sh>"]
|
| 6 |
readme = "README.md"
|
|
@@ -75,4 +75,4 @@ marker_server = "marker.scripts.server:server_cli"
|
|
| 75 |
|
| 76 |
[build-system]
|
| 77 |
requires = ["poetry-core"]
|
| 78 |
-
build-backend = "poetry.core.masonry.api"
|
|
|
|
| 1 |
[tool.poetry]
|
| 2 |
name = "marker-pdf"
|
| 3 |
+
version = "1.9.1"
|
| 4 |
description = "Convert documents to markdown with high speed and accuracy."
|
| 5 |
authors = ["Vik Paruchuri <github@vikas.sh>"]
|
| 6 |
readme = "README.md"
|
|
|
|
| 75 |
|
| 76 |
[build-system]
|
| 77 |
requires = ["poetry-core"]
|
| 78 |
+
build-backend = "poetry.core.masonry.api"
|
signatures/version1/cla.json
CHANGED
|
@@ -327,6 +327,30 @@
|
|
| 327 |
"created_at": "2025-07-04T17:42:05Z",
|
| 328 |
"repoId": 712111618,
|
| 329 |
"pullRequestNo": 789
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 330 |
}
|
| 331 |
]
|
| 332 |
}
|
|
|
|
| 327 |
"created_at": "2025-07-04T17:42:05Z",
|
| 328 |
"repoId": 712111618,
|
| 329 |
"pullRequestNo": 789
|
| 330 |
+
},
|
| 331 |
+
{
|
| 332 |
+
"name": "sandy0kwon",
|
| 333 |
+
"id": 78377296,
|
| 334 |
+
"comment_id": 3207667429,
|
| 335 |
+
"created_at": "2025-08-20T18:59:07Z",
|
| 336 |
+
"repoId": 712111618,
|
| 337 |
+
"pullRequestNo": 843
|
| 338 |
+
},
|
| 339 |
+
{
|
| 340 |
+
"name": "TwinkleXD",
|
| 341 |
+
"id": 68148987,
|
| 342 |
+
"comment_id": 3218116522,
|
| 343 |
+
"created_at": "2025-08-24T13:49:14Z",
|
| 344 |
+
"repoId": 712111618,
|
| 345 |
+
"pullRequestNo": 849
|
| 346 |
+
},
|
| 347 |
+
{
|
| 348 |
+
"name": "u-ashish",
|
| 349 |
+
"id": 14264791,
|
| 350 |
+
"comment_id": 3221349115,
|
| 351 |
+
"created_at": "2025-08-25T18:41:28Z",
|
| 352 |
+
"repoId": 712111618,
|
| 353 |
+
"pullRequestNo": 850
|
| 354 |
}
|
| 355 |
]
|
| 356 |
}
|