Expose MediaPipe Tasks in MediaPipe PyPI packages.

PiperOrigin-RevId: 485690163
This commit is contained in:
Jiuqiang Tang 2022-11-02 14:06:14 -07:00 committed by Copybara-Service
parent 0bf5110a7e
commit 01d87f0867
3 changed files with 33 additions and 2 deletions

View File

@ -11,3 +11,14 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""MediaPipe Tasks API."""
from . import components
from . import core
from . import vision
BaseOptions = core.base_options.BaseOptions
# Remove unnecessary modules to avoid duplication in API docs.
del core

View File

@ -11,3 +11,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""MediaPipe Tasks Vision API."""
import mediapipe.tasks.python.vision.core
import mediapipe.tasks.python.vision.image_classifier
import mediapipe.tasks.python.vision.object_detector
ImageClassifier = image_classifier.ImageClassifier
ImageClassifierOptions = image_classifier.ImageClassifierOptions
ObjectDetector = object_detector.ObjectDetector
ObjectDetectorOptions = object_detector.ObjectDetectorOptions
RunningMode = core.vision_task_running_mode.VisionTaskRunningMode
# Remove unnecessary modules to avoid duplication in API docs.
del core
del image_classifier
del object_detector
del mediapipe

View File

@ -121,8 +121,10 @@ def _add_mp_init_files():
mp_dir_init_file = open(MP_DIR_INIT_PY, 'a')
mp_dir_init_file.writelines([
'\n', 'from mediapipe.python import *\n',
'import mediapipe.python.solutions as solutions', '\n\n',
'__version__ = \'{}\''.format(__version__), '\n'
'import mediapipe.python.solutions as solutions \n',
'import mediapipe.tasks.python as tasks\n', '\n\n', 'del framework\n',
'del gpu\n', 'del modules\n', 'del python\n', 'del mediapipe\n',
'del util\n', '__version__ = \'{}\''.format(__version__), '\n'
])
mp_dir_init_file.close()