Expose get_graph_config function for task_runner.

PiperOrigin-RevId: 524365682
This commit is contained in:
MediaPipe Team 2023-04-14 13:00:44 -07:00 committed by Copybara-Service
parent dbeb5a8126
commit f5197a3adc
2 changed files with 10 additions and 0 deletions

View File

@ -204,6 +204,11 @@ This can be useful for resetting a stateful task graph to process new data.
Raises: Raises:
RuntimeError: The underlying medipaipe graph fails to reset and restart. RuntimeError: The underlying medipaipe graph fails to reset and restart.
)doc"); )doc");
task_runner.def(
"get_graph_config",
[](TaskRunner* self) { return self->GetGraphConfig(); },
R"doc(Returns the canonicalized CalculatorGraphConfig of the underlying graph.)doc");
} }
} // namespace python } // namespace python

View File

@ -208,6 +208,11 @@ class BaseVisionTaskApi(object):
""" """
self._runner.close() self._runner.close()
def get_graph_config(self) -> calculator_pb2.CalculatorGraphConfig:
"""Returns the canonicalized CalculatorGraphConfig of the underlying graph.
"""
return self._runner.get_graph_config()
def __enter__(self): def __enter__(self):
"""Return `self` upon entering the runtime context.""" """Return `self` upon entering the runtime context."""
return self return self