Class Introduction

Function

Interconnects and interacts with a text-to-image model.

Currently, only the stable-diffusion-v1-5 and stable-diffusion-2-1-base models are supported.

Prototype

from mx_rag.llm import Text2ImgMultiModel
Text2ImgMultiModel(url, model_name, client_param)

Parameters

Parameter

Data Type

Required/Optional

Description

url

str

Required

URL for accessing a foundation model. The length range is [1, 128].

model_name

str

Optional

Name of a Stable Diffusion model. The default value is None. The length range is (0, 128].

client_param

ClientParam

Optional

HTTPS client configuration parameter. The default value is ClientParam(). For details, see ClientParam.

Return Value

Text2ImgMultiModel object.

Example

from mx_rag.llm import Text2ImgMultiModel
from mx_rag.utils import ClientParam
multi_model = Text2ImgMultiModel(model_name="sd", url="txt to image url",
                                 client_param=ClientParam(ca_file="/path/to/ca.crt"))
res = multi_model.text2img(prompt="dog wearing black glasses", output_format="jpg", size="512*512")
print(res)