clarifai 9.10.1__py3-none-any.whl → 9.10.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- clarifai/client/__init__.py +3 -2
- clarifai/client/app.py +39 -23
- clarifai/client/base.py +6 -6
- clarifai/client/dataset.py +113 -55
- clarifai/client/input.py +47 -55
- clarifai/client/model.py +27 -25
- clarifai/client/module.py +13 -11
- clarifai/client/runner.py +5 -3
- clarifai/client/search.py +29 -10
- clarifai/client/user.py +14 -8
- clarifai/client/workflow.py +22 -20
- clarifai/constants/dataset.py +22 -0
- clarifai/datasets/upload/base.py +9 -7
- clarifai/datasets/upload/features.py +3 -3
- clarifai/datasets/upload/image.py +49 -50
- clarifai/datasets/upload/loaders/coco_captions.py +26 -80
- clarifai/datasets/upload/loaders/coco_detection.py +56 -115
- clarifai/datasets/upload/loaders/coco_segmentation.py +69 -137
- clarifai/datasets/upload/loaders/imagenet_classification.py +2 -3
- clarifai/datasets/upload/loaders/xview_detection.py +3 -3
- clarifai/datasets/upload/text.py +16 -16
- clarifai/datasets/upload/utils.py +196 -21
- clarifai/utils/misc.py +21 -0
- clarifai/versions.py +1 -1
- {clarifai-9.10.1.dist-info → clarifai-9.10.3.dist-info}/METADATA +3 -3
- clarifai-9.10.3.dist-info/RECORD +96 -0
- clarifai-9.10.3.dist-info/top_level.txt +1 -0
- clarifai/auth/__init__.py +0 -6
- clarifai/auth/helper.py +0 -367
- clarifai/auth/register.py +0 -23
- clarifai/auth/stub.py +0 -127
- clarifai/datasets/upload/examples/README.md +0 -31
- clarifai/datasets/upload/examples/image_classification/__init__.py +0 -0
- clarifai/datasets/upload/examples/image_classification/cifar10/__init__.py +0 -0
- clarifai/datasets/upload/examples/image_classification/cifar10/cifar_small_test.csv +0 -10
- clarifai/datasets/upload/examples/image_classification/cifar10/cifar_small_train.csv +0 -10
- clarifai/datasets/upload/examples/image_classification/cifar10/dataset.py +0 -46
- clarifai/datasets/upload/examples/image_classification/cifar10/images/test_batch_700.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/cifar10/images/test_batch_701.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/cifar10/images/test_batch_702.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/cifar10/images/test_batch_703.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/cifar10/images/test_batch_704.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/cifar10/images/test_batch_705.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/cifar10/images/test_batch_706.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/cifar10/images/test_batch_707.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/cifar10/images/test_batch_708.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/cifar10/images/test_batch_709.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/__init__.py +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/dataset.py +0 -39
- clarifai/datasets/upload/examples/image_classification/food-101/images/beignets/1420783.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/beignets/3287885.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/beignets/3617075.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/beignets/38052.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/beignets/39147.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/hamburger/139558.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/hamburger/1636096.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/hamburger/2480925.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/hamburger/3385808.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/hamburger/3647386.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/prime_rib/1826869.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/prime_rib/2243245.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/prime_rib/259212.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/prime_rib/2842688.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/prime_rib/3035414.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/ramen/1545393.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/ramen/2427642.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/ramen/3520891.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/ramen/377566.jpg +0 -0
- clarifai/datasets/upload/examples/image_classification/food-101/images/ramen/503504.jpg +0 -0
- clarifai/datasets/upload/examples/text_classification/__init__.py +0 -0
- clarifai/datasets/upload/examples/text_classification/imdb_dataset/__init__.py +0 -0
- clarifai/datasets/upload/examples/text_classification/imdb_dataset/dataset.py +0 -42
- clarifai/datasets/upload/examples/text_classification/imdb_dataset/test.csv +0 -201
- clarifai/datasets/upload/examples/text_classification/imdb_dataset/train.csv +0 -201
- clarifai/datasets/upload/loaders/README.md +0 -49
- clarifai/models/model_serving/README.md +0 -155
- clarifai/models/model_serving/docs/custom_config.md +0 -33
- clarifai/models/model_serving/docs/dependencies.md +0 -11
- clarifai/models/model_serving/docs/inference_parameters.md +0 -134
- clarifai/models/model_serving/docs/model_types.md +0 -20
- clarifai/models/model_serving/docs/output.md +0 -28
- clarifai/models/model_serving/examples/README.md +0 -7
- clarifai/models/model_serving/examples/image_classification/README.md +0 -9
- clarifai/models/model_serving/examples/image_classification/age_vit/1/vit-age-classifier/README.md +0 -11
- clarifai/models/model_serving/examples/image_classification/age_vit/1/vit-age-classifier/config.json +0 -42
- clarifai/models/model_serving/examples/image_classification/age_vit/1/vit-age-classifier/preprocessor_config.json +0 -15
- clarifai/models/model_serving/examples/image_classification/age_vit/config.pbtxt +0 -23
- clarifai/models/model_serving/examples/image_classification/age_vit/labels.txt +0 -9
- clarifai/models/model_serving/examples/image_classification/age_vit/requirements.txt +0 -7
- clarifai/models/model_serving/examples/text_classification/README.md +0 -9
- clarifai/models/model_serving/examples/text_classification/xlm-roberta/1/twitter-xlm-roberta-base-sentiment/README.md +0 -12
- clarifai/models/model_serving/examples/text_classification/xlm-roberta/1/twitter-xlm-roberta-base-sentiment/config.json +0 -34
- clarifai/models/model_serving/examples/text_classification/xlm-roberta/1/twitter-xlm-roberta-base-sentiment/special_tokens_map.json +0 -1
- clarifai/models/model_serving/examples/text_classification/xlm-roberta/config.pbtxt +0 -21
- clarifai/models/model_serving/examples/text_classification/xlm-roberta/labels.txt +0 -3
- clarifai/models/model_serving/examples/text_classification/xlm-roberta/requirements.txt +0 -7
- clarifai/models/model_serving/examples/text_embedding/README.md +0 -9
- clarifai/models/model_serving/examples/text_to_image/README.md +0 -9
- clarifai/models/model_serving/examples/text_to_image/sd-v1.5/1/__init__.py +0 -0
- clarifai/models/model_serving/examples/text_to_image/sd-v1.5/1/inference.py +0 -52
- clarifai/models/model_serving/examples/text_to_image/sd-v1.5/1/model.py +0 -60
- clarifai/models/model_serving/examples/text_to_image/sd-v1.5/config.pbtxt +0 -22
- clarifai/models/model_serving/examples/text_to_image/sd-v1.5/requirements.txt +0 -6
- clarifai/models/model_serving/examples/text_to_text/README.md +0 -10
- clarifai/models/model_serving/examples/text_to_text/bart-summarize/config.pbtxt +0 -20
- clarifai/models/model_serving/examples/text_to_text/bart-summarize/requirements.txt +0 -4
- clarifai/models/model_serving/examples/visual_detection/README.md +0 -11
- clarifai/models/model_serving/examples/visual_detection/yolov5x/config.pbtxt +0 -36
- clarifai/models/model_serving/examples/visual_detection/yolov5x/labels.txt +0 -80
- clarifai/models/model_serving/examples/visual_detection/yolov5x/requirements.txt +0 -12
- clarifai/models/model_serving/examples/visual_embedding/README.md +0 -9
- clarifai/models/model_serving/examples/visual_embedding/vit-base/config.pbtxt +0 -22
- clarifai/models/model_serving/examples/visual_embedding/vit-base/requirements.txt +0 -5
- clarifai/models/model_serving/examples/visual_segmentation/README.md +0 -9
- clarifai/models/model_serving/examples/visual_segmentation/segformer-b2/config.pbtxt +0 -24
- clarifai/models/model_serving/examples/visual_segmentation/segformer-b2/labels.txt +0 -18
- clarifai/models/model_serving/examples/visual_segmentation/segformer-b2/requirements.txt +0 -5
- clarifai/models/model_serving/model_config/model_types_config/multimodal-embedder.yaml +0 -24
- clarifai/models/model_serving/model_config/model_types_config/text-classifier.yaml +0 -18
- clarifai/models/model_serving/model_config/model_types_config/text-embedder.yaml +0 -18
- clarifai/models/model_serving/model_config/model_types_config/text-to-image.yaml +0 -18
- clarifai/models/model_serving/model_config/model_types_config/text-to-text.yaml +0 -18
- clarifai/models/model_serving/model_config/model_types_config/visual-classifier.yaml +0 -18
- clarifai/models/model_serving/model_config/model_types_config/visual-detector.yaml +0 -28
- clarifai/models/model_serving/model_config/model_types_config/visual-embedder.yaml +0 -18
- clarifai/models/model_serving/model_config/model_types_config/visual-segmenter.yaml +0 -18
- clarifai/modules/README.md +0 -5
- clarifai/modules/style.css +0 -217
- clarifai-9.10.1.dist-info/RECORD +0 -386
- clarifai-9.10.1.dist-info/top_level.txt +0 -2
- clarifai_utils/__init__.py +0 -0
- clarifai_utils/auth/__init__.py +0 -6
- clarifai_utils/auth/helper.py +0 -367
- clarifai_utils/auth/register.py +0 -23
- clarifai_utils/auth/stub.py +0 -127
- clarifai_utils/cli.py +0 -0
- clarifai_utils/client/__init__.py +0 -16
- clarifai_utils/client/app.py +0 -684
- clarifai_utils/client/auth/__init__.py +0 -4
- clarifai_utils/client/auth/helper.py +0 -367
- clarifai_utils/client/auth/register.py +0 -23
- clarifai_utils/client/auth/stub.py +0 -127
- clarifai_utils/client/base.py +0 -131
- clarifai_utils/client/dataset.py +0 -442
- clarifai_utils/client/input.py +0 -892
- clarifai_utils/client/lister.py +0 -54
- clarifai_utils/client/model.py +0 -575
- clarifai_utils/client/module.py +0 -94
- clarifai_utils/client/runner.py +0 -161
- clarifai_utils/client/search.py +0 -239
- clarifai_utils/client/user.py +0 -253
- clarifai_utils/client/workflow.py +0 -223
- clarifai_utils/constants/model.py +0 -4
- clarifai_utils/constants/search.py +0 -2
- clarifai_utils/datasets/__init__.py +0 -0
- clarifai_utils/datasets/export/__init__.py +0 -0
- clarifai_utils/datasets/export/inputs_annotations.py +0 -222
- clarifai_utils/datasets/upload/__init__.py +0 -0
- clarifai_utils/datasets/upload/base.py +0 -66
- clarifai_utils/datasets/upload/examples/README.md +0 -31
- clarifai_utils/datasets/upload/examples/image_classification/__init__.py +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/cifar10/__init__.py +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/cifar10/cifar_small_test.csv +0 -10
- clarifai_utils/datasets/upload/examples/image_classification/cifar10/cifar_small_train.csv +0 -10
- clarifai_utils/datasets/upload/examples/image_classification/cifar10/dataset.py +0 -46
- clarifai_utils/datasets/upload/examples/image_classification/cifar10/images/test_batch_700.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/cifar10/images/test_batch_701.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/cifar10/images/test_batch_702.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/cifar10/images/test_batch_703.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/cifar10/images/test_batch_704.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/cifar10/images/test_batch_705.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/cifar10/images/test_batch_706.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/cifar10/images/test_batch_707.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/cifar10/images/test_batch_708.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/cifar10/images/test_batch_709.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/__init__.py +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/dataset.py +0 -39
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/beignets/1420783.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/beignets/3287885.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/beignets/3617075.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/beignets/38052.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/beignets/39147.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/hamburger/139558.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/hamburger/1636096.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/hamburger/2480925.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/hamburger/3385808.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/hamburger/3647386.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/prime_rib/1826869.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/prime_rib/2243245.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/prime_rib/259212.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/prime_rib/2842688.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/prime_rib/3035414.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/ramen/1545393.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/ramen/2427642.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/ramen/3520891.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/ramen/377566.jpg +0 -0
- clarifai_utils/datasets/upload/examples/image_classification/food-101/images/ramen/503504.jpg +0 -0
- clarifai_utils/datasets/upload/examples/text_classification/__init__.py +0 -0
- clarifai_utils/datasets/upload/examples/text_classification/imdb_dataset/__init__.py +0 -0
- clarifai_utils/datasets/upload/examples/text_classification/imdb_dataset/dataset.py +0 -42
- clarifai_utils/datasets/upload/examples/text_classification/imdb_dataset/test.csv +0 -201
- clarifai_utils/datasets/upload/examples/text_classification/imdb_dataset/train.csv +0 -201
- clarifai_utils/datasets/upload/features.py +0 -44
- clarifai_utils/datasets/upload/image.py +0 -165
- clarifai_utils/datasets/upload/loaders/README.md +0 -49
- clarifai_utils/datasets/upload/loaders/__init__.py +0 -0
- clarifai_utils/datasets/upload/loaders/coco_captions.py +0 -103
- clarifai_utils/datasets/upload/loaders/coco_detection.py +0 -134
- clarifai_utils/datasets/upload/loaders/coco_segmentation.py +0 -166
- clarifai_utils/datasets/upload/loaders/imagenet_classification.py +0 -59
- clarifai_utils/datasets/upload/loaders/xview_detection.py +0 -148
- clarifai_utils/datasets/upload/text.py +0 -53
- clarifai_utils/datasets/upload/utils.py +0 -63
- clarifai_utils/errors.py +0 -89
- clarifai_utils/models/__init__.py +0 -0
- clarifai_utils/models/api.py +0 -283
- clarifai_utils/models/model_serving/README.md +0 -155
- clarifai_utils/models/model_serving/__init__.py +0 -12
- clarifai_utils/models/model_serving/cli/__init__.py +0 -12
- clarifai_utils/models/model_serving/cli/deploy_cli.py +0 -123
- clarifai_utils/models/model_serving/cli/model_zip.py +0 -61
- clarifai_utils/models/model_serving/cli/repository.py +0 -87
- clarifai_utils/models/model_serving/constants.py +0 -1
- clarifai_utils/models/model_serving/docs/custom_config.md +0 -33
- clarifai_utils/models/model_serving/docs/dependencies.md +0 -11
- clarifai_utils/models/model_serving/docs/inference_parameters.md +0 -134
- clarifai_utils/models/model_serving/docs/model_types.md +0 -20
- clarifai_utils/models/model_serving/docs/output.md +0 -28
- clarifai_utils/models/model_serving/examples/README.md +0 -7
- clarifai_utils/models/model_serving/examples/image_classification/README.md +0 -9
- clarifai_utils/models/model_serving/examples/image_classification/age_vit/1/__init__.py +0 -0
- clarifai_utils/models/model_serving/examples/image_classification/age_vit/1/inference.py +0 -56
- clarifai_utils/models/model_serving/examples/image_classification/age_vit/1/model.py +0 -61
- clarifai_utils/models/model_serving/examples/image_classification/age_vit/1/vit-age-classifier/README.md +0 -11
- clarifai_utils/models/model_serving/examples/image_classification/age_vit/1/vit-age-classifier/config.json +0 -42
- clarifai_utils/models/model_serving/examples/image_classification/age_vit/1/vit-age-classifier/preprocessor_config.json +0 -15
- clarifai_utils/models/model_serving/examples/image_classification/age_vit/config.pbtxt +0 -23
- clarifai_utils/models/model_serving/examples/image_classification/age_vit/labels.txt +0 -9
- clarifai_utils/models/model_serving/examples/image_classification/age_vit/requirements.txt +0 -7
- clarifai_utils/models/model_serving/examples/text_classification/README.md +0 -9
- clarifai_utils/models/model_serving/examples/text_classification/xlm-roberta/1/__init__.py +0 -0
- clarifai_utils/models/model_serving/examples/text_classification/xlm-roberta/1/inference.py +0 -55
- clarifai_utils/models/model_serving/examples/text_classification/xlm-roberta/1/model.py +0 -61
- clarifai_utils/models/model_serving/examples/text_classification/xlm-roberta/1/twitter-xlm-roberta-base-sentiment/README.md +0 -12
- clarifai_utils/models/model_serving/examples/text_classification/xlm-roberta/1/twitter-xlm-roberta-base-sentiment/config.json +0 -34
- clarifai_utils/models/model_serving/examples/text_classification/xlm-roberta/1/twitter-xlm-roberta-base-sentiment/special_tokens_map.json +0 -1
- clarifai_utils/models/model_serving/examples/text_classification/xlm-roberta/config.pbtxt +0 -21
- clarifai_utils/models/model_serving/examples/text_classification/xlm-roberta/labels.txt +0 -3
- clarifai_utils/models/model_serving/examples/text_classification/xlm-roberta/requirements.txt +0 -7
- clarifai_utils/models/model_serving/examples/text_embedding/README.md +0 -9
- clarifai_utils/models/model_serving/examples/text_to_image/README.md +0 -9
- clarifai_utils/models/model_serving/examples/text_to_image/sd-v1.5/1/__init__.py +0 -0
- clarifai_utils/models/model_serving/examples/text_to_image/sd-v1.5/1/inference.py +0 -52
- clarifai_utils/models/model_serving/examples/text_to_image/sd-v1.5/1/model.py +0 -60
- clarifai_utils/models/model_serving/examples/text_to_image/sd-v1.5/config.pbtxt +0 -22
- clarifai_utils/models/model_serving/examples/text_to_image/sd-v1.5/requirements.txt +0 -6
- clarifai_utils/models/model_serving/examples/text_to_text/README.md +0 -10
- clarifai_utils/models/model_serving/examples/text_to_text/bart-summarize/1/__init__.py +0 -0
- clarifai_utils/models/model_serving/examples/text_to_text/bart-summarize/1/inference.py +0 -47
- clarifai_utils/models/model_serving/examples/text_to_text/bart-summarize/1/model.py +0 -60
- clarifai_utils/models/model_serving/examples/text_to_text/bart-summarize/config.pbtxt +0 -20
- clarifai_utils/models/model_serving/examples/text_to_text/bart-summarize/requirements.txt +0 -4
- clarifai_utils/models/model_serving/examples/visual_detection/README.md +0 -11
- clarifai_utils/models/model_serving/examples/visual_detection/yolov5x/1/inference.py +0 -72
- clarifai_utils/models/model_serving/examples/visual_detection/yolov5x/1/model.py +0 -61
- clarifai_utils/models/model_serving/examples/visual_detection/yolov5x/config.pbtxt +0 -36
- clarifai_utils/models/model_serving/examples/visual_detection/yolov5x/labels.txt +0 -80
- clarifai_utils/models/model_serving/examples/visual_detection/yolov5x/requirements.txt +0 -12
- clarifai_utils/models/model_serving/examples/visual_embedding/README.md +0 -9
- clarifai_utils/models/model_serving/examples/visual_embedding/vit-base/1/__init__.py +0 -0
- clarifai_utils/models/model_serving/examples/visual_embedding/vit-base/1/inference.py +0 -51
- clarifai_utils/models/model_serving/examples/visual_embedding/vit-base/1/model.py +0 -60
- clarifai_utils/models/model_serving/examples/visual_embedding/vit-base/config.pbtxt +0 -22
- clarifai_utils/models/model_serving/examples/visual_embedding/vit-base/requirements.txt +0 -5
- clarifai_utils/models/model_serving/examples/visual_segmentation/README.md +0 -9
- clarifai_utils/models/model_serving/examples/visual_segmentation/segformer-b2/1/__init__.py +0 -0
- clarifai_utils/models/model_serving/examples/visual_segmentation/segformer-b2/1/inference.py +0 -55
- clarifai_utils/models/model_serving/examples/visual_segmentation/segformer-b2/1/model.py +0 -60
- clarifai_utils/models/model_serving/examples/visual_segmentation/segformer-b2/config.pbtxt +0 -24
- clarifai_utils/models/model_serving/examples/visual_segmentation/segformer-b2/labels.txt +0 -18
- clarifai_utils/models/model_serving/examples/visual_segmentation/segformer-b2/requirements.txt +0 -5
- clarifai_utils/models/model_serving/model_config/__init__.py +0 -14
- clarifai_utils/models/model_serving/model_config/config.py +0 -302
- clarifai_utils/models/model_serving/model_config/inference_parameter.py +0 -124
- clarifai_utils/models/model_serving/model_config/model_types_config/multimodal-embedder.yaml +0 -24
- clarifai_utils/models/model_serving/model_config/model_types_config/text-classifier.yaml +0 -18
- clarifai_utils/models/model_serving/model_config/model_types_config/text-embedder.yaml +0 -18
- clarifai_utils/models/model_serving/model_config/model_types_config/text-to-image.yaml +0 -18
- clarifai_utils/models/model_serving/model_config/model_types_config/text-to-text.yaml +0 -18
- clarifai_utils/models/model_serving/model_config/model_types_config/visual-classifier.yaml +0 -18
- clarifai_utils/models/model_serving/model_config/model_types_config/visual-detector.yaml +0 -28
- clarifai_utils/models/model_serving/model_config/model_types_config/visual-embedder.yaml +0 -18
- clarifai_utils/models/model_serving/model_config/model_types_config/visual-segmenter.yaml +0 -18
- clarifai_utils/models/model_serving/model_config/serializer.py +0 -134
- clarifai_utils/models/model_serving/models/__init__.py +0 -12
- clarifai_utils/models/model_serving/models/default_test.py +0 -275
- clarifai_utils/models/model_serving/models/inference.py +0 -42
- clarifai_utils/models/model_serving/models/model_types.py +0 -265
- clarifai_utils/models/model_serving/models/output.py +0 -124
- clarifai_utils/models/model_serving/models/pb_model.py +0 -74
- clarifai_utils/models/model_serving/models/test.py +0 -64
- clarifai_utils/models/model_serving/pb_model_repository.py +0 -101
- clarifai_utils/modules/README.md +0 -5
- clarifai_utils/modules/__init__.py +0 -0
- clarifai_utils/modules/css.py +0 -60
- clarifai_utils/modules/pages.py +0 -42
- clarifai_utils/modules/style.css +0 -217
- clarifai_utils/runners/__init__.py +0 -0
- clarifai_utils/runners/example.py +0 -33
- clarifai_utils/schema/search.py +0 -69
- clarifai_utils/urls/helper.py +0 -103
- clarifai_utils/utils/__init__.py +0 -0
- clarifai_utils/utils/logging.py +0 -90
- clarifai_utils/utils/misc.py +0 -33
- clarifai_utils/utils/model_train.py +0 -157
- clarifai_utils/versions.py +0 -6
- clarifai_utils/workflows/__init__.py +0 -0
- clarifai_utils/workflows/export.py +0 -68
- clarifai_utils/workflows/utils.py +0 -59
- clarifai_utils/workflows/validate.py +0 -67
- {clarifai-9.10.1.dist-info → clarifai-9.10.3.dist-info}/LICENSE +0 -0
- {clarifai-9.10.1.dist-info → clarifai-9.10.3.dist-info}/WHEEL +0 -0
- {clarifai-9.10.1.dist-info → clarifai-9.10.3.dist-info}/entry_points.txt +0 -0
clarifai_utils/modules/pages.py
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import glob
|
|
2
|
-
import importlib
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class ClarifaiModulePageManager(object):
|
|
6
|
-
|
|
7
|
-
def __init__(self):
|
|
8
|
-
# List all the available pages.
|
|
9
|
-
page_files = sorted(glob.glob("pages/*.py"))
|
|
10
|
-
self.page_names = [f.replace("pages/", "").replace(".py", "") for f in page_files]
|
|
11
|
-
|
|
12
|
-
def get_page_from_query_params(self, qp):
|
|
13
|
-
"""
|
|
14
|
-
Args:
|
|
15
|
-
qp: the streamlit query params st.experimental_get_query_params()
|
|
16
|
-
"""
|
|
17
|
-
# Get the page from query params or default to 1 from the url.
|
|
18
|
-
page = qp.get("page", [None])[0]
|
|
19
|
-
if page is None:
|
|
20
|
-
page = self.page_names[0]
|
|
21
|
-
# Check that the page number coming in is within the range of pages in the folder.
|
|
22
|
-
if page not in self.page_names:
|
|
23
|
-
raise Exception(
|
|
24
|
-
"Page '%s' is not valid, there is no pages/%s.py file for this page. Valid page names are: %s"
|
|
25
|
-
% (page, page, str(self.page_names)))
|
|
26
|
-
|
|
27
|
-
return page
|
|
28
|
-
|
|
29
|
-
def get_page_names(self):
|
|
30
|
-
return self.page_names
|
|
31
|
-
|
|
32
|
-
def render_page(self, page):
|
|
33
|
-
# Since the page re-renders every time the selectbox changes, we'll always have the latest page out
|
|
34
|
-
# of the query params.
|
|
35
|
-
module_str = "pages.%s" % page
|
|
36
|
-
# check if the page exists
|
|
37
|
-
importlib.util.find_spec(module_str)
|
|
38
|
-
if page is None:
|
|
39
|
-
raise Exception("Page %s is was not found." % page)
|
|
40
|
-
|
|
41
|
-
current_page = importlib.import_module(module_str)
|
|
42
|
-
current_page.display()
|
clarifai_utils/modules/style.css
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
body {
|
|
2
|
-
font-family: -apple-system,system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.stDataFrame {
|
|
6
|
-
font-family: -apple-system,system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.stButton>button, .stDownloadButton>button, .stButton>a {
|
|
10
|
-
color: #fff;
|
|
11
|
-
background-color: #195AFF;
|
|
12
|
-
border-color: transparent;
|
|
13
|
-
font-size: 14px;
|
|
14
|
-
font-weight: 600;
|
|
15
|
-
outline: 0;
|
|
16
|
-
padding: 0.625rem 1rem;
|
|
17
|
-
text-align: center;
|
|
18
|
-
cursor: pointer;
|
|
19
|
-
position: relative;
|
|
20
|
-
justify-content: center;
|
|
21
|
-
align-items: center;
|
|
22
|
-
appearance: button;
|
|
23
|
-
text-decoration: none;
|
|
24
|
-
height: 40px;
|
|
25
|
-
font-family: -apple-system,system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
|
|
26
|
-
}
|
|
27
|
-
.stButton>a {
|
|
28
|
-
font-family: -apple-system,system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
|
|
29
|
-
font-size: 14px;
|
|
30
|
-
}
|
|
31
|
-
.stButton>button>div {
|
|
32
|
-
font-family: -apple-system,system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
|
|
33
|
-
font-size: 14px;
|
|
34
|
-
}
|
|
35
|
-
.stButton>button>div>p {
|
|
36
|
-
font-family: -apple-system,system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
|
|
37
|
-
font-size: 14px;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.ourButton>a:hover,
|
|
41
|
-
.stButton>button:hover,
|
|
42
|
-
.stButton>button:focus,
|
|
43
|
-
.stButton>button:focus:not(:active),
|
|
44
|
-
.stButton>button:active,
|
|
45
|
-
.stDownloadButton>button:hover,
|
|
46
|
-
.stDownloadButton>button:focus,
|
|
47
|
-
.stDownloadButton>button:focus:not(:active),
|
|
48
|
-
.stDownloadButton>button:active
|
|
49
|
-
{
|
|
50
|
-
color: #fff;
|
|
51
|
-
border-color: transparent;
|
|
52
|
-
box-shadow: none !important;
|
|
53
|
-
background-color: #0046D4;
|
|
54
|
-
text-decoration: none;
|
|
55
|
-
}
|
|
56
|
-
.stDownloadButton>a {
|
|
57
|
-
font-family: -apple-system,system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
|
|
58
|
-
font-size: 14px;
|
|
59
|
-
}
|
|
60
|
-
.stDownloadButton>button>div {
|
|
61
|
-
font-family: -apple-system,system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
|
|
62
|
-
font-size: 14px;
|
|
63
|
-
}
|
|
64
|
-
.stDownloadButton>button>div>p {
|
|
65
|
-
font-family: -apple-system,system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
|
|
66
|
-
font-size: 14px;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.stCheckbox > label > span {
|
|
70
|
-
border: 1px solid #D0D5DD;
|
|
71
|
-
transition: all 0.1s;
|
|
72
|
-
width: 20px;
|
|
73
|
-
height: 20px;
|
|
74
|
-
border-radius: 0.4rem;
|
|
75
|
-
}
|
|
76
|
-
.stCheckbox > label > span:has(+ input[aria-checked="true"]) {
|
|
77
|
-
background-color: #f2f6fe;
|
|
78
|
-
background-size: auto;
|
|
79
|
-
background-image: url('data:image/svg+xml,%3Csvg%20width%3D%2212%22%20height%3D%229%22%20viewBox%3D%220%200%2012%209%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M10.6663%201.5L4.24967%207.91667L1.33301%205%22%20stroke%3D%22%23195AFF%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E');
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.stSelectbox > div > div,
|
|
83
|
-
.stMultiSelect > div > div > div,
|
|
84
|
-
.stTextArea > div > div,
|
|
85
|
-
.stTimeInput > div > div
|
|
86
|
-
{
|
|
87
|
-
background-color: transparent;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
.stNumberInput > div > div:first-of-type {
|
|
92
|
-
border-radius: 8px 0 0 8px;
|
|
93
|
-
background-color: transparent;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.stNumberInput button:last-of-type {
|
|
97
|
-
color: #fff;
|
|
98
|
-
background-color: #195AFF;
|
|
99
|
-
border-color: transparent;
|
|
100
|
-
border-radius: 0 7px 7px 0;
|
|
101
|
-
box-shadow: 0 1px 2px rgba(16,24,40,.05);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.stNumberInput>div {
|
|
105
|
-
color: #fff;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.stNumberInput>div>div>button {
|
|
109
|
-
color: #fff;
|
|
110
|
-
background-color: #195AFF;
|
|
111
|
-
border-color: transparent;
|
|
112
|
-
}
|
|
113
|
-
.stNumberInput>div>div>button:hover,
|
|
114
|
-
.stNumberInput>div>div>button:hover:enabled,
|
|
115
|
-
.stNumberInput>div>div>button:focus,
|
|
116
|
-
.stNumberInput>div>div>button:focus:enabled,
|
|
117
|
-
.stNumberInput>div>div>button:focus:not(:active),
|
|
118
|
-
.stNumberInput>div>div>button:active
|
|
119
|
-
{
|
|
120
|
-
color: #fff;
|
|
121
|
-
border-color: transparent;
|
|
122
|
-
box-shadow: none !important;
|
|
123
|
-
background-color: #0046D4;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
div[data-testid="stFileUploader"]>section>button {
|
|
128
|
-
color: #fff;
|
|
129
|
-
background-color: #195AFF;
|
|
130
|
-
padding: 0.625rem 1rem;
|
|
131
|
-
font-weight: 600;
|
|
132
|
-
font-family: -apple-system,system-ui,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
|
|
133
|
-
font-size: 14px;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
div[data-testid="stFileUploader"]>section>button:hover,
|
|
137
|
-
div[data-testid="stFileUploader"]>section>button:hover:enabled,
|
|
138
|
-
div[data-testid="stFileUploader"]>section>button:focus,
|
|
139
|
-
div[data-testid="stFileUploader"]>section>button:focus:enabled,
|
|
140
|
-
div[data-testid="stFileUploader"]>section>button:focus:not(:active),
|
|
141
|
-
div[data-testid="stFileUploader"]>section>button:active
|
|
142
|
-
{
|
|
143
|
-
color: #fff;
|
|
144
|
-
border-color: transparent;
|
|
145
|
-
box-shadow: none !important;
|
|
146
|
-
background-color: #0046D4;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
div[data-baseweb="base-input"] {
|
|
151
|
-
color: #4F8BF9;
|
|
152
|
-
background-color: #fff;
|
|
153
|
-
border-radius: 9.8px;
|
|
154
|
-
border-color: transparent;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
footer {
|
|
159
|
-
display: none !important;
|
|
160
|
-
color: #FFF !important;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
div[data-testid="stDecoration"] {
|
|
164
|
-
display: none !important;
|
|
165
|
-
background-image: none;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.stSlider > div {
|
|
169
|
-
padding-left: 5px;
|
|
170
|
-
padding-right: 2px;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.streamlit-expanderContent
|
|
174
|
-
{
|
|
175
|
-
padding-top: 10px;
|
|
176
|
-
}
|
|
177
|
-
.stAlert > div,
|
|
178
|
-
.stTextInput > div,
|
|
179
|
-
.stTextInput > div > div,
|
|
180
|
-
.stException > div,
|
|
181
|
-
.stDataFrame > div > div,
|
|
182
|
-
.stDataFrame > div,
|
|
183
|
-
div[data-testid="stExpander"] > ul,
|
|
184
|
-
div[data-testid="stExpander"] > ul > li,
|
|
185
|
-
div[data-testid="stExpander"] > ul > li > div,
|
|
186
|
-
div[data-testid="stFileUploader"]>section>button,
|
|
187
|
-
.stButton>button,
|
|
188
|
-
.stDownloadButton>button,
|
|
189
|
-
.stButton>a,
|
|
190
|
-
.stSelectbox > div > div,
|
|
191
|
-
.stMultiSelect > div > div,
|
|
192
|
-
.stMultiSelect > div > div > div,
|
|
193
|
-
.stTextArea > div,
|
|
194
|
-
.stTextArea > div > div,
|
|
195
|
-
.stDateInput > div > div,
|
|
196
|
-
.stDateInput > div > div > div,
|
|
197
|
-
.stTimeInput > div > div,
|
|
198
|
-
.stNumberInput>div,
|
|
199
|
-
pre:has(> div > code),
|
|
200
|
-
code
|
|
201
|
-
{
|
|
202
|
-
border-radius: 8px !important;
|
|
203
|
-
border-color: #d0d5dd;
|
|
204
|
-
box-shadow: 0 1px 2px rgba(16,24,40,.05);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
.stTextInput > div > div > input {
|
|
208
|
-
background-color: white;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
div[data-testid="stFileUploader"]>section {
|
|
214
|
-
border: 1px dashed #d0d5dd;
|
|
215
|
-
border-radius: 8px;
|
|
216
|
-
background-color: #f7fafe;
|
|
217
|
-
}
|
|
File without changes
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
from clarifai_grpc.grpc.api import resources_pb2
|
|
2
|
-
|
|
3
|
-
from clarifai.client.runner import Runner
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class MyRunner(Runner):
|
|
7
|
-
"""A custom runner that adds "Hello World" to the end of the text and replaces the domain of the
|
|
8
|
-
image URL as an example.
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
def run_input(self, input: resources_pb2.Input) -> resources_pb2.Output:
|
|
12
|
-
"""This is the method that will be called when the runner is run. It takes in an input and
|
|
13
|
-
returns an output.
|
|
14
|
-
"""
|
|
15
|
-
|
|
16
|
-
output = resources_pb2.Output()
|
|
17
|
-
|
|
18
|
-
data = input.data
|
|
19
|
-
|
|
20
|
-
if data.text.raw != "":
|
|
21
|
-
output.data.text.raw = data.text.raw + "Hello World"
|
|
22
|
-
if data.image.url != "":
|
|
23
|
-
output.data.text.raw = data.image.url.replace("samples.clarifai.com", "newdomain.com")
|
|
24
|
-
return output
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if __name__ == '__main__':
|
|
28
|
-
# Make sure you set these env vars before running the example.
|
|
29
|
-
# CLARIFAI_PAT
|
|
30
|
-
# CLARIFAI_USER_ID
|
|
31
|
-
|
|
32
|
-
# You need to first create a runner in the Clarifai API and then use the ID here.
|
|
33
|
-
MyRunner(runner_id="sdk-test-runner").start()
|
clarifai_utils/schema/search.py
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
from schema import And, Optional, Regex, Schema
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def get_schema() -> Schema:
|
|
5
|
-
"""Initialize the schema for rank and filter.
|
|
6
|
-
|
|
7
|
-
This schema validates:
|
|
8
|
-
|
|
9
|
-
- Rank and filter must be a list
|
|
10
|
-
- Each item in the list must be a dict
|
|
11
|
-
- The dict can contain these optional keys:
|
|
12
|
-
- 'image_url': Valid URL string
|
|
13
|
-
- 'text_raw': Non-empty string
|
|
14
|
-
- 'metadata': Dict
|
|
15
|
-
- 'image_bytes': Bytes
|
|
16
|
-
- 'geo_point': Dict with 'longitude', 'latitude' and 'geo_limit' as float, float and int respectively
|
|
17
|
-
- 'concepts': List where each item is a concept dict
|
|
18
|
-
- Concept dict requires at least one of:
|
|
19
|
-
- 'name': Non-empty string with dashes/underscores
|
|
20
|
-
- 'id': Non-empty string
|
|
21
|
-
- 'language': Non-empty string
|
|
22
|
-
- 'value': 0 or 1 integer
|
|
23
|
-
|
|
24
|
-
Returns:
|
|
25
|
-
Schema: The schema for rank and filter.
|
|
26
|
-
"""
|
|
27
|
-
# Schema for a single concept
|
|
28
|
-
concept_schema = Schema({
|
|
29
|
-
Optional('value'):
|
|
30
|
-
And(int, lambda x: x in [0, 1]),
|
|
31
|
-
Optional('id'):
|
|
32
|
-
And(str, len),
|
|
33
|
-
Optional('language'):
|
|
34
|
-
And(str, len),
|
|
35
|
-
# Non-empty strings with internal dashes and underscores.
|
|
36
|
-
Optional('name'):
|
|
37
|
-
And(str, len, Regex(r'^[0-9A-Za-z]+([-_][0-9A-Za-z]+)*$'))
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
# Schema for a rank or filter item
|
|
41
|
-
rank_filter_item_schema = Schema({
|
|
42
|
-
Optional('image_url'):
|
|
43
|
-
And(str, Regex(r'^https?://')),
|
|
44
|
-
Optional('text_raw'):
|
|
45
|
-
And(str, len),
|
|
46
|
-
Optional('metadata'):
|
|
47
|
-
dict,
|
|
48
|
-
Optional('image_bytes'):
|
|
49
|
-
bytes,
|
|
50
|
-
Optional('geo_point'): {
|
|
51
|
-
'longitude': float,
|
|
52
|
-
'latitude': float,
|
|
53
|
-
'geo_limit': int
|
|
54
|
-
},
|
|
55
|
-
Optional("concepts"):
|
|
56
|
-
And(list, lambda x: all(concept_schema.is_valid(item) and len(item) > 0 for item in x)),
|
|
57
|
-
|
|
58
|
-
## input filters
|
|
59
|
-
Optional('input_types'):
|
|
60
|
-
And(list, lambda input_types: all(input_type in ('image', 'video', 'text', 'audio')
|
|
61
|
-
for input_type in input_types)),
|
|
62
|
-
Optional('input_dataset_ids'):
|
|
63
|
-
list,
|
|
64
|
-
Optional('input_status_code'):
|
|
65
|
-
int,
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
# Schema for rank and filter args
|
|
69
|
-
return Schema([rank_filter_item_schema])
|
clarifai_utils/urls/helper.py
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
from urllib.parse import urlparse
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class ClarifaiUrlHelper(object):
|
|
5
|
-
"""Lots of helper functionality for dealing with urls around modules."""
|
|
6
|
-
|
|
7
|
-
def __init__(self, auth, module_manager_imv_id="module_manager_install"):
|
|
8
|
-
"""
|
|
9
|
-
Args:
|
|
10
|
-
auth: a ClarifaiAuthHelper object.
|
|
11
|
-
"""
|
|
12
|
-
self._auth = auth
|
|
13
|
-
self._module_manager_imv_id = module_manager_imv_id
|
|
14
|
-
|
|
15
|
-
@property
|
|
16
|
-
def auth(self):
|
|
17
|
-
return self._auth
|
|
18
|
-
|
|
19
|
-
def module_ui_url(self, user_id, app_id, module_id, module_version_id):
|
|
20
|
-
"""This is the path to the module in community."""
|
|
21
|
-
return "%s/%s/%s/modules/%s/versions/%s" % (
|
|
22
|
-
self.auth.ui,
|
|
23
|
-
user_id,
|
|
24
|
-
app_id,
|
|
25
|
-
module_id,
|
|
26
|
-
module_version_id,
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
def module_install_ui_url(self, dest_user_id, dest_app_id, module_url):
|
|
30
|
-
"""This is a url that allows for installation of the module from the community at 'module_url'
|
|
31
|
-
into the destination app_id of the destination user_id."""
|
|
32
|
-
return ("%s/%s/%s/installed_module_versions/%s/install?install=%s" %
|
|
33
|
-
(self.auth.ui, dest_user_id, dest_app_id, self._module_manager_imv_id, module_url))
|
|
34
|
-
|
|
35
|
-
def imv_ui_url(self, dest_user_id, dest_app_id, imv_id):
|
|
36
|
-
return ("%s/%s/%s/installed_module_versions/%s" % (self.auth.ui, dest_user_id, dest_app_id,
|
|
37
|
-
imv_id))
|
|
38
|
-
|
|
39
|
-
def clarifai_url(self, user_id, app_id, resource_type, resource_id, version_id: str = None):
|
|
40
|
-
"""This is the path to the resource in community.
|
|
41
|
-
|
|
42
|
-
Args:
|
|
43
|
-
user_id: the author of the resource.
|
|
44
|
-
app_id: the author's app the resource was created in.
|
|
45
|
-
resource_type: the type of resource. One of "modules", "models", "concepts", "inputs", "workflows", "tasks", "installed_module_versions"
|
|
46
|
-
resource_id: the resource ID
|
|
47
|
-
version_id: the version of the resource.
|
|
48
|
-
"""
|
|
49
|
-
if resource_type not in [
|
|
50
|
-
"modules", "models", "concepts", "inputs", "workflows", "tasks",
|
|
51
|
-
"installed_module_versions"
|
|
52
|
-
]:
|
|
53
|
-
raise ValueError(
|
|
54
|
-
"resource_type must be one of modules, models, concepts, inputs, workflows, tasks, installed_module_versions but was %s"
|
|
55
|
-
% resource_type)
|
|
56
|
-
if version_id is None:
|
|
57
|
-
return "%s/%s/%s/%s/%s" % (self.auth.ui, user_id, app_id, resource_type, resource_id)
|
|
58
|
-
return "%s/%s/%s/%s/%s/versions/%s" % (self.auth.ui, user_id, app_id, resource_type,
|
|
59
|
-
resource_id, version_id)
|
|
60
|
-
|
|
61
|
-
@classmethod
|
|
62
|
-
def split_clarifai_url(cls, url):
|
|
63
|
-
"""
|
|
64
|
-
clarifai.com uses fully qualified urls to resources.
|
|
65
|
-
They are in the format of:
|
|
66
|
-
https://clarifai.com/{user_id}/{app_id}/{resource_type}/{resource_id}/{resource_version_type}/{resource_version_id}
|
|
67
|
-
Those last two are optional.
|
|
68
|
-
|
|
69
|
-
"""
|
|
70
|
-
url = url.replace("https://", "", 1).replace("http://", "", 1)
|
|
71
|
-
o = urlparse(url)
|
|
72
|
-
path = o.path
|
|
73
|
-
path = path.lstrip("/")
|
|
74
|
-
parts = path.split("/")
|
|
75
|
-
if len(parts) != 5 and len(parts) != 7:
|
|
76
|
-
raise ValueError(
|
|
77
|
-
"Provided url must have 4 or 6 parts after the domain name. These are: {user_id}/{app_id}/{resource_type}/{resource_id}/{resource_version_type}/{resource_version_id}"
|
|
78
|
-
)
|
|
79
|
-
user_id, app_id, resource_type, resource_id = parts[1:5]
|
|
80
|
-
if len(parts) == 7:
|
|
81
|
-
resource_version_id = parts[6]
|
|
82
|
-
else:
|
|
83
|
-
resource_version_id = None
|
|
84
|
-
return user_id, app_id, resource_type, resource_id, resource_version_id
|
|
85
|
-
|
|
86
|
-
@classmethod
|
|
87
|
-
def split_module_ui_url(cls, install):
|
|
88
|
-
"""Takes in a path like https://clarifai.com/zeiler/app/modules/module1/versions/2 to split it apart into it's IDs.
|
|
89
|
-
|
|
90
|
-
Returns:
|
|
91
|
-
user_id: the author of the module.
|
|
92
|
-
app_id: the author's app the module was created in.
|
|
93
|
-
module_id: the module ID
|
|
94
|
-
module_version_id: the version of the module.
|
|
95
|
-
"""
|
|
96
|
-
user_id, app_id, resource_type, resource_id, resource_version_id = cls.split_clarifai_url(
|
|
97
|
-
install)
|
|
98
|
-
|
|
99
|
-
if resource_type != "modules" or resource_version_id is None:
|
|
100
|
-
raise ValueError(
|
|
101
|
-
"Provided install url must have 6 parts after the domain name. These are {user_id}/{app_id}/modules/{module_id}/versions/{module_version_id}"
|
|
102
|
-
)
|
|
103
|
-
return user_id, app_id, resource_id, resource_version_id
|
clarifai_utils/utils/__init__.py
DELETED
|
File without changes
|
clarifai_utils/utils/logging.py
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from collections import defaultdict
|
|
3
|
-
from typing import Dict, List, Optional
|
|
4
|
-
|
|
5
|
-
from rich import print as rprint
|
|
6
|
-
from rich.logging import RichHandler
|
|
7
|
-
from rich.table import Table
|
|
8
|
-
from rich.traceback import install
|
|
9
|
-
from rich.tree import Tree
|
|
10
|
-
|
|
11
|
-
install()
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def display_workflow_tree(nodes_data: List[Dict]) -> None:
|
|
15
|
-
"""Displays a tree of the workflow nodes."""
|
|
16
|
-
# Create a mapping of node_id to the list of node_ids that are connected to it.
|
|
17
|
-
node_adj_mapping = defaultdict(list)
|
|
18
|
-
# Create a mapping of node_id to the node data info.
|
|
19
|
-
nodes_data_dict = {}
|
|
20
|
-
for node in nodes_data:
|
|
21
|
-
nodes_data_dict[node["id"]] = node
|
|
22
|
-
if node.get("node_inputs", "") == "":
|
|
23
|
-
node_adj_mapping["Input"].append(node["id"])
|
|
24
|
-
else:
|
|
25
|
-
for node_input in node["node_inputs"]:
|
|
26
|
-
node_adj_mapping[node_input["node_id"]].append(node["id"])
|
|
27
|
-
|
|
28
|
-
# Get all leaf nodes.
|
|
29
|
-
leaf_node_ids = set()
|
|
30
|
-
for node_id in list(nodes_data_dict.keys()):
|
|
31
|
-
if node_adj_mapping.get(node_id, "") == "":
|
|
32
|
-
leaf_node_ids.add(node_id)
|
|
33
|
-
|
|
34
|
-
def build_node_tree(node_id="Input"):
|
|
35
|
-
"""Recursively builds a rich tree of the workflow nodes."""
|
|
36
|
-
# Set the style of the current node.
|
|
37
|
-
style_str = "green" if node_id in leaf_node_ids else "white"
|
|
38
|
-
|
|
39
|
-
# Create a Tree object for the current node.
|
|
40
|
-
if node_id != "Input":
|
|
41
|
-
node_table = table_from_dict(
|
|
42
|
-
[nodes_data_dict[node_id]["model"]],
|
|
43
|
-
column_names=["id", "model_type_id", "app_id", "user_id"],
|
|
44
|
-
title="Node: " + node_id)
|
|
45
|
-
|
|
46
|
-
tree = Tree(node_table, style=style_str, guide_style="underline2 white")
|
|
47
|
-
else:
|
|
48
|
-
tree = Tree(f"[green] {node_id}", style=style_str, guide_style="underline2 white")
|
|
49
|
-
|
|
50
|
-
# Recursively add the child nodes of the current node to the tree.
|
|
51
|
-
for child in node_adj_mapping.get(node_id, []):
|
|
52
|
-
tree.add(build_node_tree(child))
|
|
53
|
-
|
|
54
|
-
# Return the tree.
|
|
55
|
-
return tree
|
|
56
|
-
|
|
57
|
-
tree = build_node_tree("Input")
|
|
58
|
-
rprint(tree)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
def table_from_dict(data: List[Dict], column_names: List[str], title: str = "") -> Table:
|
|
62
|
-
"""Use this function for printing tables from a list of dicts."""
|
|
63
|
-
table = Table(title=title, show_lines=False, show_header=True, header_style="blue")
|
|
64
|
-
for column_name in column_names:
|
|
65
|
-
table.add_column(column_name)
|
|
66
|
-
for row in data:
|
|
67
|
-
req_row = [row.get(column_name, "") for column_name in column_names]
|
|
68
|
-
table.add_row(*req_row)
|
|
69
|
-
return table
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
def _get_library_name() -> str:
|
|
73
|
-
return __name__.split(".")[0]
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def _configure_logger(logger_level: str = "ERROR") -> None:
|
|
77
|
-
logging.basicConfig(
|
|
78
|
-
level=logger_level,
|
|
79
|
-
datefmt='%Y-%m-%d %H:%M:%S',
|
|
80
|
-
handlers=[RichHandler(rich_tracebacks=True)])
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
def get_logger(logger_level: str = "ERROR", name: Optional[str] = None) -> logging.Logger:
|
|
84
|
-
"""Return a logger with the specified name."""
|
|
85
|
-
|
|
86
|
-
if name is None:
|
|
87
|
-
name = _get_library_name()
|
|
88
|
-
|
|
89
|
-
_configure_logger(logger_level)
|
|
90
|
-
return logging.getLogger(name)
|
clarifai_utils/utils/misc.py
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
from typing import List
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class Chunker:
|
|
5
|
-
"""Split an input sequence into small chunks."""
|
|
6
|
-
|
|
7
|
-
def __init__(self, seq: List, size: int) -> None:
|
|
8
|
-
self.seq = seq
|
|
9
|
-
self.size = size
|
|
10
|
-
|
|
11
|
-
def chunk(self) -> List[List]:
|
|
12
|
-
"""Chunk input sequence."""
|
|
13
|
-
return [self.seq[pos:pos + self.size] for pos in range(0, len(self.seq), self.size)]
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class BackoffIterator:
|
|
17
|
-
"""Iterator that returns a sequence of backoff values."""
|
|
18
|
-
|
|
19
|
-
def __init__(self):
|
|
20
|
-
self.count = 0
|
|
21
|
-
|
|
22
|
-
def __iter__(self):
|
|
23
|
-
return self
|
|
24
|
-
|
|
25
|
-
def __next__(self):
|
|
26
|
-
if self.count < 1:
|
|
27
|
-
self.count += 1
|
|
28
|
-
return 0.1
|
|
29
|
-
elif self.count < 7:
|
|
30
|
-
self.count += 1
|
|
31
|
-
return 0.01 * (2**(self.count + 4))
|
|
32
|
-
else:
|
|
33
|
-
return 0.01 * (2**10) # 10 seconds
|