djai.model.models.base module

DjAI base AIModel class.

class djai.model.models.base.AIModel(*args, **kwargs)[source]

Bases: polymorphic.models.PolymorphicModel, djai.util.models._ModelWithUUIDPKAndOptionalUniqueNameAndTimestampsABC

DjAI base AIModel class.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

cloud_ai_svcs

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

created

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

dash_ui

Decorator that converts a method with a single cls argument into a property that can be accessed directly from the class.

abstract fit(**kwargs) Any[source]

Fit.

get_next_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=True, **kwargs)
get_next_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=True, **kwargs)
get_previous_by_created(*, field=<model_utils.fields.AutoCreatedField: created>, is_next=False, **kwargs)
get_previous_by_modified(*, field=<model_utils.fields.AutoLastModifiedField: modified>, is_next=False, **kwargs)
gradio_ui = Gradio Interface for: predict ----------------------------- inputs: outputs: |-JSON(label="AI Model Output")
modified

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

name: CharField

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

params: django.db.models.fields.json.JSONField

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

polymorphic_ctype

The model field that stores the ContentType reference to the actual class.

polymorphic_ctype_id
polymorphic_primary_key_name = 'uuid'
polymorphic_super_sub_accessors_replaced = False
abstract predict(**kwargs) Any[source]

Predict.

pretrained_hugging_face_transformers

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

pretrained_keras_imagenet_classifiers

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

subclass_full_qual_names = ['djai.model.models.base._AIModelWithArtifactFilesABC', 'djai.model.models.ml.skl.SKLModel', 'djai.model.models.ml.keras.base.KerasModel', 'djai.model.models.ml.base._PreTrainedMLModelABC', 'djai.model.models.ml.keras.pre_trained.vision.image_classification.PreTrainedKerasImageNetClassifier', 'djai.model.models.ml.hugging_face.base.PreTrainedHuggingFaceTransformer', 'djai.model.models.ml.hugging_face.audio_classification.PreTrainedHuggingFaceAudioClassifier', 'djai.model.models.ml.hugging_face.image_classification.PreTrainedHuggingFaceImageClassifier', 'djai.model.models.ml.hugging_face.mask_filling.PreTrainedHuggingFaceMaskFiller', 'djai.model.models.ml.hugging_face.object_detection.PreTrainedHuggingFaceObjectDetector', 'djai.model.models.ml.hugging_face.question_answering.PreTrainedHuggingFaceQuestionAnswerer', 'djai.model.models.ml.hugging_face.speech_recognition.PreTrainedHuggingFaceSpeechRecognizer', 'djai.model.models.ml.hugging_face.table_question_answering.PreTrainedHuggingFaceTableQuestionAnswerer', 'djai.model.models.ml.hugging_face.text_classification.PreTrainedHuggingFaceTextClassifier', 'djai.model.models.ml.hugging_face.text_generation.PreTrainedHuggingFaceTextGenerator', 'djai.model.models.ml.hugging_face.text2text_generation.PreTrainedHuggingFaceText2TextGenerator', 'djai.model.models.ml.hugging_face.text_summarization.PreTrainedHuggingFaceTextSummarizer', 'djai.model.models.ml.hugging_face.token_classification.PreTrainedHuggingFaceTokenClassifier', 'djai.model.models.ml.hugging_face.translation.PreTrainedHuggingFaceTranslator', 'djai.model.models.ml.hugging_face.zero_shot_classification.PreTrainedHuggingFaceZeroShotClassifier', 'djai.model.models.ml.torch.base.TorchModel', 'djai.model.models.cloud_ai_svc.base.CloudAIService', 'djai.model.models.cloud_ai_svc.google.translation.GoogleTranslate']
subclass_names = ['_AIModelWithArtifactFilesABC', 'SKLModel', 'KerasModel', '_PreTrainedMLModelABC', 'PreTrainedKerasImageNetClassifier', 'PreTrainedHuggingFaceTransformer', 'PreTrainedHuggingFaceAudioClassifier', 'PreTrainedHuggingFaceImageClassifier', 'PreTrainedHuggingFaceMaskFiller', 'PreTrainedHuggingFaceObjectDetector', 'PreTrainedHuggingFaceQuestionAnswerer', 'PreTrainedHuggingFaceSpeechRecognizer', 'PreTrainedHuggingFaceTableQuestionAnswerer', 'PreTrainedHuggingFaceTextClassifier', 'PreTrainedHuggingFaceTextGenerator', 'PreTrainedHuggingFaceText2TextGenerator', 'PreTrainedHuggingFaceTextSummarizer', 'PreTrainedHuggingFaceTokenClassifier', 'PreTrainedHuggingFaceTranslator', 'PreTrainedHuggingFaceZeroShotClassifier', 'TorchModel', 'CloudAIService', 'GoogleTranslate']
subclasses = [<class 'djai.model.models.base._AIModelWithArtifactFilesABC'>, <class 'djai.model.models.ml.skl.SKLModel'>, <class 'djai.model.models.ml.keras.base.KerasModel'>, <class 'djai.model.models.ml.base._PreTrainedMLModelABC'>, <class 'djai.model.models.ml.keras.pre_trained.vision.image_classification.PreTrainedKerasImageNetClassifier'>, <class 'djai.model.models.ml.hugging_face.base.PreTrainedHuggingFaceTransformer'>, <class 'djai.model.models.ml.hugging_face.audio_classification.PreTrainedHuggingFaceAudioClassifier'>, <class 'djai.model.models.ml.hugging_face.image_classification.PreTrainedHuggingFaceImageClassifier'>, <class 'djai.model.models.ml.hugging_face.mask_filling.PreTrainedHuggingFaceMaskFiller'>, <class 'djai.model.models.ml.hugging_face.object_detection.PreTrainedHuggingFaceObjectDetector'>, <class 'djai.model.models.ml.hugging_face.question_answering.PreTrainedHuggingFaceQuestionAnswerer'>, <class 'djai.model.models.ml.hugging_face.speech_recognition.PreTrainedHuggingFaceSpeechRecognizer'>, <class 'djai.model.models.ml.hugging_face.table_question_answering.PreTrainedHuggingFaceTableQuestionAnswerer'>, <class 'djai.model.models.ml.hugging_face.text_classification.PreTrainedHuggingFaceTextClassifier'>, <class 'djai.model.models.ml.hugging_face.text_generation.PreTrainedHuggingFaceTextGenerator'>, <class 'djai.model.models.ml.hugging_face.text2text_generation.PreTrainedHuggingFaceText2TextGenerator'>, <class 'djai.model.models.ml.hugging_face.text_summarization.PreTrainedHuggingFaceTextSummarizer'>, <class 'djai.model.models.ml.hugging_face.token_classification.PreTrainedHuggingFaceTokenClassifier'>, <class 'djai.model.models.ml.hugging_face.translation.PreTrainedHuggingFaceTranslator'>, <class 'djai.model.models.ml.hugging_face.zero_shot_classification.PreTrainedHuggingFaceZeroShotClassifier'>, <class 'djai.model.models.ml.torch.base.TorchModel'>, <class 'djai.model.models.cloud_ai_svc.base.CloudAIService'>, <class 'djai.model.models.cloud_ai_svc.google.translation.GoogleTranslate'>]
subclasses_by_full_qual_name = {'djai.model.models.base._AIModelWithArtifactFilesABC': <class 'djai.model.models.base._AIModelWithArtifactFilesABC'>, 'djai.model.models.cloud_ai_svc.base.CloudAIService': <class 'djai.model.models.cloud_ai_svc.base.CloudAIService'>, 'djai.model.models.cloud_ai_svc.google.translation.GoogleTranslate': <class 'djai.model.models.cloud_ai_svc.google.translation.GoogleTranslate'>, 'djai.model.models.ml.base._PreTrainedMLModelABC': <class 'djai.model.models.ml.base._PreTrainedMLModelABC'>, 'djai.model.models.ml.hugging_face.audio_classification.PreTrainedHuggingFaceAudioClassifier': <class 'djai.model.models.ml.hugging_face.audio_classification.PreTrainedHuggingFaceAudioClassifier'>, 'djai.model.models.ml.hugging_face.base.PreTrainedHuggingFaceTransformer': <class 'djai.model.models.ml.hugging_face.base.PreTrainedHuggingFaceTransformer'>, 'djai.model.models.ml.hugging_face.image_classification.PreTrainedHuggingFaceImageClassifier': <class 'djai.model.models.ml.hugging_face.image_classification.PreTrainedHuggingFaceImageClassifier'>, 'djai.model.models.ml.hugging_face.mask_filling.PreTrainedHuggingFaceMaskFiller': <class 'djai.model.models.ml.hugging_face.mask_filling.PreTrainedHuggingFaceMaskFiller'>, 'djai.model.models.ml.hugging_face.object_detection.PreTrainedHuggingFaceObjectDetector': <class 'djai.model.models.ml.hugging_face.object_detection.PreTrainedHuggingFaceObjectDetector'>, 'djai.model.models.ml.hugging_face.question_answering.PreTrainedHuggingFaceQuestionAnswerer': <class 'djai.model.models.ml.hugging_face.question_answering.PreTrainedHuggingFaceQuestionAnswerer'>, 'djai.model.models.ml.hugging_face.speech_recognition.PreTrainedHuggingFaceSpeechRecognizer': <class 'djai.model.models.ml.hugging_face.speech_recognition.PreTrainedHuggingFaceSpeechRecognizer'>, 'djai.model.models.ml.hugging_face.table_question_answering.PreTrainedHuggingFaceTableQuestionAnswerer': <class 'djai.model.models.ml.hugging_face.table_question_answering.PreTrainedHuggingFaceTableQuestionAnswerer'>, 'djai.model.models.ml.hugging_face.text2text_generation.PreTrainedHuggingFaceText2TextGenerator': <class 'djai.model.models.ml.hugging_face.text2text_generation.PreTrainedHuggingFaceText2TextGenerator'>, 'djai.model.models.ml.hugging_face.text_classification.PreTrainedHuggingFaceTextClassifier': <class 'djai.model.models.ml.hugging_face.text_classification.PreTrainedHuggingFaceTextClassifier'>, 'djai.model.models.ml.hugging_face.text_generation.PreTrainedHuggingFaceTextGenerator': <class 'djai.model.models.ml.hugging_face.text_generation.PreTrainedHuggingFaceTextGenerator'>, 'djai.model.models.ml.hugging_face.text_summarization.PreTrainedHuggingFaceTextSummarizer': <class 'djai.model.models.ml.hugging_face.text_summarization.PreTrainedHuggingFaceTextSummarizer'>, 'djai.model.models.ml.hugging_face.token_classification.PreTrainedHuggingFaceTokenClassifier': <class 'djai.model.models.ml.hugging_face.token_classification.PreTrainedHuggingFaceTokenClassifier'>, 'djai.model.models.ml.hugging_face.translation.PreTrainedHuggingFaceTranslator': <class 'djai.model.models.ml.hugging_face.translation.PreTrainedHuggingFaceTranslator'>, 'djai.model.models.ml.hugging_face.zero_shot_classification.PreTrainedHuggingFaceZeroShotClassifier': <class 'djai.model.models.ml.hugging_face.zero_shot_classification.PreTrainedHuggingFaceZeroShotClassifier'>, 'djai.model.models.ml.keras.base.KerasModel': <class 'djai.model.models.ml.keras.base.KerasModel'>, 'djai.model.models.ml.keras.pre_trained.vision.image_classification.PreTrainedKerasImageNetClassifier': <class 'djai.model.models.ml.keras.pre_trained.vision.image_classification.PreTrainedKerasImageNetClassifier'>, 'djai.model.models.ml.skl.SKLModel': <class 'djai.model.models.ml.skl.SKLModel'>, 'djai.model.models.ml.torch.base.TorchModel': <class 'djai.model.models.ml.torch.base.TorchModel'>}
subclasses_by_name = {'CloudAIService': <class 'djai.model.models.cloud_ai_svc.base.CloudAIService'>, 'GoogleTranslate': <class 'djai.model.models.cloud_ai_svc.google.translation.GoogleTranslate'>, 'KerasModel': <class 'djai.model.models.ml.keras.base.KerasModel'>, 'PreTrainedHuggingFaceAudioClassifier': <class 'djai.model.models.ml.hugging_face.audio_classification.PreTrainedHuggingFaceAudioClassifier'>, 'PreTrainedHuggingFaceImageClassifier': <class 'djai.model.models.ml.hugging_face.image_classification.PreTrainedHuggingFaceImageClassifier'>, 'PreTrainedHuggingFaceMaskFiller': <class 'djai.model.models.ml.hugging_face.mask_filling.PreTrainedHuggingFaceMaskFiller'>, 'PreTrainedHuggingFaceObjectDetector': <class 'djai.model.models.ml.hugging_face.object_detection.PreTrainedHuggingFaceObjectDetector'>, 'PreTrainedHuggingFaceQuestionAnswerer': <class 'djai.model.models.ml.hugging_face.question_answering.PreTrainedHuggingFaceQuestionAnswerer'>, 'PreTrainedHuggingFaceSpeechRecognizer': <class 'djai.model.models.ml.hugging_face.speech_recognition.PreTrainedHuggingFaceSpeechRecognizer'>, 'PreTrainedHuggingFaceTableQuestionAnswerer': <class 'djai.model.models.ml.hugging_face.table_question_answering.PreTrainedHuggingFaceTableQuestionAnswerer'>, 'PreTrainedHuggingFaceText2TextGenerator': <class 'djai.model.models.ml.hugging_face.text2text_generation.PreTrainedHuggingFaceText2TextGenerator'>, 'PreTrainedHuggingFaceTextClassifier': <class 'djai.model.models.ml.hugging_face.text_classification.PreTrainedHuggingFaceTextClassifier'>, 'PreTrainedHuggingFaceTextGenerator': <class 'djai.model.models.ml.hugging_face.text_generation.PreTrainedHuggingFaceTextGenerator'>, 'PreTrainedHuggingFaceTextSummarizer': <class 'djai.model.models.ml.hugging_face.text_summarization.PreTrainedHuggingFaceTextSummarizer'>, 'PreTrainedHuggingFaceTokenClassifier': <class 'djai.model.models.ml.hugging_face.token_classification.PreTrainedHuggingFaceTokenClassifier'>, 'PreTrainedHuggingFaceTransformer': <class 'djai.model.models.ml.hugging_face.base.PreTrainedHuggingFaceTransformer'>, 'PreTrainedHuggingFaceTranslator': <class 'djai.model.models.ml.hugging_face.translation.PreTrainedHuggingFaceTranslator'>, 'PreTrainedHuggingFaceZeroShotClassifier': <class 'djai.model.models.ml.hugging_face.zero_shot_classification.PreTrainedHuggingFaceZeroShotClassifier'>, 'PreTrainedKerasImageNetClassifier': <class 'djai.model.models.ml.keras.pre_trained.vision.image_classification.PreTrainedKerasImageNetClassifier'>, 'SKLModel': <class 'djai.model.models.ml.skl.SKLModel'>, 'TorchModel': <class 'djai.model.models.ml.torch.base.TorchModel'>, '_AIModelWithArtifactFilesABC': <class 'djai.model.models.base._AIModelWithArtifactFilesABC'>, '_PreTrainedMLModelABC': <class 'djai.model.models.ml.base._PreTrainedMLModelABC'>}
uuid: UUIDField

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.