Skip to content
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