Checks if a custom global resource provider is used as the first step of loading the model resources on all platforms.

PiperOrigin-RevId: 493141519
This commit is contained in:
Jiuqiang Tang
2022-12-05 16:20:20 -08:00
committed by Copybara-Service
parent 99d1dd6fbb
commit 1e76d47a71
4 changed files with 21 additions and 15 deletions
+2
View File
@@ -37,6 +37,8 @@ absl::Status GetResourceContents(const std::string& path, std::string* output,
return internal::DefaultGetResourceContents(path, output, read_as_binary);
}
bool HasCustomGlobalResourceProvider() { return resource_provider_ != nullptr; }
void SetCustomGlobalResourceProvider(ResourceProviderFn fn) {
resource_provider_ = std::move(fn);
}
+3
View File
@@ -10,6 +10,9 @@ namespace mediapipe {
typedef std::function<absl::Status(const std::string&, std::string*)>
ResourceProviderFn;
// Returns true if files are provided via a custom resource provider.
bool HasCustomGlobalResourceProvider();
// Overrides the behavior of GetResourceContents.
void SetCustomGlobalResourceProvider(ResourceProviderFn fn);