diff --git a/mediapipe/tasks/python/core/base_options.py b/mediapipe/tasks/python/core/base_options.py index 728e61edea..d9481f6732 100644 --- a/mediapipe/tasks/python/core/base_options.py +++ b/mediapipe/tasks/python/core/base_options.py @@ -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