djai.model.models.ml.hugging_face.translation module¶
DjAI Pre-Trained Hugging Face Translator Model class.
- class djai.model.models.ml.hugging_face.translation.PreTrainedHuggingFaceTranslator(*args, **kwargs)[source]¶
Bases:
djai.model.models.ml.hugging_face.base.PreTrainedHuggingFaceTransformer
DjAI Pre-Trained Hugging Face Translator Model class.
- exception DoesNotExist¶
Bases:
djai.model.models.ml.hugging_face.base.PreTrainedHuggingFaceTransformer.DoesNotExist
- exception MultipleObjectsReturned¶
Bases:
djai.model.models.ml.hugging_face.base.PreTrainedHuggingFaceTransformer.MultipleObjectsReturned
- gradio_ui = Gradio Interface for: predict ----------------------------- inputs: |-Textbox(label="Text to Summarize") |-Checkbox(label="Return Tensors?") |-Checkbox(label="Return Text?") |-Checkbox(label="Clean Up Spaces?") |-Dropdown(label="Source Language") |-Dropdown(label="Target Language") outputs: |-JSON(label="Translated Text")¶
- polymorphic_primary_key_name = 'uuid'¶
- polymorphic_super_sub_accessors_replaced = False¶
- predict(text_or_texts: Union[str, collections.abc.Sequence[str]], return_tensors: bool = False, return_text: bool = True, clean_up_tokenization_spaces: bool = True, src_lang: Optional[str] = None, tgt_lang: Optional[str] = None, **generate_kwargs) Union[str, List[int], List[Union[str, List[int]]]] [source]¶
Translate Text(s).
- pretrainedhuggingfacetransformer_ptr¶
Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
- pretrainedhuggingfacetransformer_ptr_id¶