mmagic.apis.inferencers.text2image_inferencer
¶
Module Contents¶
Classes¶
inferencer that predicts with text2image models. |
- class mmagic.apis.inferencers.text2image_inferencer.Text2ImageInferencer(config: Union[mmagic.utils.ConfigType, str], ckpt: Optional[str], device: Optional[str] = None, extra_parameters: Optional[Dict] = None, seed: int = 2022, **kwargs)[source]¶
Bases:
mmagic.apis.inferencers.base_mmagic_inferencer.BaseMMagicInferencer
inferencer that predicts with text2image models.
- preprocess(text: mmagic.apis.inferencers.base_mmagic_inferencer.InputsType, control: str = None, negative_prompt: mmagic.apis.inferencers.base_mmagic_inferencer.InputsType = None) Dict [source]¶
Process the inputs into a model-feedable format.
- Parameters
text (InputsType) – text input for text-to-image model.
control (str) – control img dir for controlnet.
negative_prompt (InputsType) – negative prompt.
- Returns
Results of preprocess.
- Return type
result(Dict)
- forward(inputs: mmagic.apis.inferencers.base_mmagic_inferencer.InputsType) mmagic.apis.inferencers.base_mmagic_inferencer.PredType [source]¶
Forward the inputs to the model.
- visualize(preds: mmagic.apis.inferencers.base_mmagic_inferencer.PredType, result_out_dir: str = None) List[numpy.ndarray] [source]¶
Visualize predictions.
- Parameters
preds (List[Union[str, np.ndarray]]) – Forward results by the inferencer.
result_out_dir (str) – Output directory of image. Defaults to ‘’.
- Returns
Result of visualize
- Return type
List[np.ndarray]