Hide internal APIs from mediapipe pip package's API docs.

PiperOrigin-RevId: 493607984
This commit is contained in:
Khanh LeViet 2022-12-07 08:13:51 -08:00 committed by Copybara-Service
parent aad797197b
commit d9688b769f

View File

@ -13,6 +13,13 @@
# limitations under the License.
"""MediaPipe Tasks' common but optional dependencies."""
# TensorFlow isn't a dependency of mediapipe pip package. It's only
# required in the API docgen pipeline so we'll ignore it if tensorflow is not
# installed.
try:
from tensorflow.tools.docs import doc_controls
except ModuleNotFoundError:
# Replace the real doc_controls.do_not_generate_docs with an no-op
doc_controls = lambda: None
no_op = lambda x: x
setattr(doc_controls, 'do_not_generate_docs', no_op)