Skip to content

Commit

Permalink
Fix issue with llm service
Browse files Browse the repository at this point in the history
  • Loading branch information
VikParuchuri committed Feb 14, 2025
1 parent cdd482b commit b75c404
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion marker/config/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def get_llm_service(self):
if not self.cli_options.get("use_llm", False):
return None

service_cls = self.cli_options["llm_service"]
service_cls = self.cli_options.get("llm_service", None)
if service_cls is None:
service_cls = "marker.services.gemini.GoogleGeminiService"
return service_cls
Expand Down
6 changes: 3 additions & 3 deletions marker/services/gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class BaseGeminiService(BaseService):

def img_to_bytes(self, img: PIL.Image.Image):
image_bytes = BytesIO()
img.save(image_bytes, format="PNG")
img.save(image_bytes, format="WEBP")
return image_bytes.getvalue()

def get_google_client(self, timeout: int):
Expand All @@ -45,7 +45,7 @@ def __call__(
image = [image]

client = self.get_google_client(timeout=timeout)
image_parts = [types.Part.from_bytes(data=self.img_to_bytes(img), mime_type="image/png") for img in image]
image_parts = [types.Part.from_bytes(data=self.img_to_bytes(img), mime_type="image/webp") for img in image]

tries = 0
while tries < max_retries:
Expand All @@ -57,7 +57,7 @@ def __call__(
"temperature": 0,
"response_schema": response_schema,
"response_mime_type": "application/json",
}
},
)
output = responses.candidates[0].content.parts[0].text
total_tokens = responses.usage_metadata.total_token_count
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "marker-pdf"
version = "1.5.1"
version = "1.5.2"
description = "Convert PDF to markdown with high speed and accuracy."
authors = ["Vik Paruchuri <github@vikas.sh>"]
readme = "README.md"
Expand Down

0 comments on commit b75c404

Please sign in to comment.