(container.image)
- generate - Image generations
Given a description, the model generates image.
import os
from friendli import SyncFriendli
with SyncFriendli(
token=os.getenv("FRIENDLI_TOKEN", ""),
) as friendli:
res = friendli.container.image.generate(
guidance_scale=3.5,
num_inference_steps=10,
prompt="An orange Lamborghini driving down a hill road at night with a beautiful ocean view in the background.",
model="(adapter-route)",
response_format="jpeg",
)
# Handle response
print(res)| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
guidance_scale |
float | ✔️ | Adjusts the alignment of the generated image with the input prompt. Higher values (e.g., 8-10) make the output more faithful to the prompt, while lower values (e.g., 1-5) encourage more creative freedom. This parameter may be irrelevant for certain models, such as FLUX.Schnell. |
|
num_inference_steps |
int | ✔️ | The number of inference steps to use during image generation. Supported range: [1, 50]. | |
prompt |
str | ✔️ | A text description of the desired image. | |
model |
OptionalNullable[str] | ➖ | Routes the request to a specific adapter. | (adapter-route) |
response_format |
OptionalNullable[models.ContainerImageGenerationBodyResponseFormat] | ➖ | The format in which the generated image will be returned. One of raw and jpeg. |
|
seed |
OptionalNullable[int] | ➖ | The seed to use for image generation. | |
retries |
Optional[utils.RetryConfig] | ➖ | Configuration to override the default retry behavior of the client. | |
server_url |
Optional[str] | ➖ | An optional server URL to use. | http://localhost:8080 |
models.ContainerImageGenerateSuccess
| Error Type | Status Code | Content Type |
|---|---|---|
| models.SDKError | 4XX, 5XX | */* |