Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update base_options.py Fix Windows Path Concatenation Issue with mode… #5722

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion mediapipe/tasks/python/core/base_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,15 @@ def to_pb2(self) -> _BaseOptionsProto:
acceleration_proto = _AccelerationProto(tflite=_DelegateProto.TfLite())
else:
acceleration_proto = None


if platform_name == 'Windows' and full_path is not None:
try:
with open(full_path, "rb") as f:
self.model_asset_buffer = f.read()
self.model_asset_path = None
except FileNotFoundError:
raise RuntimeError(f"Unable to open file at {full_path}.")

return _BaseOptionsProto(
model_asset=_ExternalFileProto(
file_name=full_path, file_content=self.model_asset_buffer
Expand Down