選取您的 Cookie 偏好設定

我們使用提供自身網站和服務所需的基本 Cookie 和類似工具。我們使用效能 Cookie 收集匿名統計資料,以便了解客戶如何使用我們的網站並進行改進。基本 Cookie 無法停用,但可以按一下「自訂」或「拒絕」以拒絕效能 Cookie。

如果您同意,AWS 與經核准的第三方也會使用 Cookie 提供實用的網站功能、記住您的偏好設定,並顯示相關內容,包括相關廣告。若要接受或拒絕所有非必要 Cookie,請按一下「接受」或「拒絕」。若要進行更詳細的選擇,請按一下「自訂」。

https://Stability.ai Stable Diffusion 3

焦點模式
https://Stability.ai Stable Diffusion 3 - Amazon Bedrock

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

Stable Diffusion 3 模型和穩定影像核心模型具有下列推論參數和模型回應,可用於進行推論呼叫。

Stable Diffusion 3 大型請求和回應

請求本文在請求 body 欄位中傳遞到 InvokeModelInvokeModelWithResponseStream

模型調用請求內文欄位

當您使用Stable Diffusion 3大型模型進行 InvokeModel 呼叫時,請以如下所示的 JSON 物件填入內文欄位。

{ 'prompt': 'Create an image of a panda' }

模型調用回應內文欄位

當您使用Stable Diffusion 3大型模型進行InvokeModel呼叫時,回應如下所示

{ 'seeds': [2130420379], "finish_reasons": [null], "images": ["..."] }

完整原因不是 的回應null會如下所示:

{ "finish_reasons": ["Filter reason: prompt"] }
  • seeds – (字串) 用於為模型產生映像的種子清單。

  • finish_reasons – 列舉,指出請求是否已篩選。 null會指出請求成功。目前可能的值:"Filter reason: prompt", "Filter reason: output image", "Filter reason: input image", "Inference error", null

  • 映像 – base64 字串格式的產生映像清單。

如需詳細資訊,請參閱 https://platform.stability.ai/docs/api-reference#tag/v1generation

Text to image

Stability.ai Stable Diffusion 3 Large 模型具有下列text-to-image推論呼叫的推論參數。

  • prompt – (字串) 您希望在輸出映像中看到的內容。強烈的描述性提示,明確定義元素、顏色和主題將帶來更好的結果。

    下限 最大

    0

    10,000

選用欄位

  • aspect_ratio – (字串) 控制產生影像的長寬比。此參數僅適用於text-to-image請求。預設 1:1。列舉:16:9、1:1、21:9、2:3、3:2、4:5、5:4、9:16、9:21。

  • 模式 – 控制這是text-to-image還是image-to-image產生,這會影響需要哪些參數。預設:text-to-image。列舉:image-to-imagetext-to-image

  • output_format – 指定輸出映像的格式。支援的格式:JPEG、PNG。支援的維度:高度 640 到 1,536 px,寬度 640 到 1,536 px。

  • seed – (number) 用來引導產生之「隨機度」的特定值。(省略此參數或傳遞 0 以使用隨機種子。) 範圍:0 到 4294967295。

  • negative_prompt – 您不希望在輸出影像中看到的關鍵字。上限:10.000 個字元。

import boto3 import json import base64 import io from PIL import Image bedrock = boto3.client('bedrock-runtime', region_name='us-west-2') response = bedrock.invoke_model( modelId='stability.sd3-large-v1:0', body=json.dumps({ 'prompt': 'A car made out of vegetables.' }) ) output_body = json.loads(response["body"].read().decode("utf-8")) base64_output_image = output_body["images"][0] image_data = base64.b64decode(base64_output_image) image = Image.open(io.BytesIO(image_data)) image.save("image.png")
Image to image

Stability.ai Stable Diffusion 3 Large 模型具有下列image-to-image推論呼叫的推論參數。

text_prompts (必要) — 用於生成的文字提示陣列。每個元素都是 JSON 物件,其中包含提示和提示的權重。

  • prompt – (字串) 您希望在輸出映像中看到的內容。強烈的描述性提示,明確定義元素、顏色和主題將帶來更好的結果。

    下限 最大

    0

    10,000

  • image – base64 格式的字串。用作產生之起點的影像。支援的格式:JPEG、PNG、WEBP (主控台不支援WEBP)、支援的維度:寬度:640 - 1536 px、高度:640 - 1536 px。

  • 強度 – 數值。有時稱為雜訊消除,此參數會控制影像參數對產生影像的影響程度。值為 0 會產生與輸入相同的影像。值 1 就像您完全沒有傳入影像一樣。範圍:【0, 1】

  • 模式 – 必須設定為 image-to-image

選用欄位

  • aspect_ratio – (字串) 控制產生影像的長寬比。此參數僅適用於text-to-image請求。預設 1:1。列舉:16:9、1:1、21:9、2:3、3:2、4:5、5:4、9:16、9:21。

  • 模式 – 控制這是text-to-image還是image-to-image產生,這會影響需要哪些參數。預設:text-to-image。列舉:image-to-imagetext-to-image

  • output_format – 指定輸出映像的格式。支援的格式:JPEG、PNG。支援的維度:高度 640 到 1,536 px,寬度 640 到 1,536 px。

  • seed – (number) 用來引導產生之「隨機度」的特定值。(省略此參數或傳遞 0 以使用隨機種子。) 範圍:0 到 4294967295。

  • negative_prompt – 您不希望在輸出影像中看到的關鍵字。上限:10.000 個字元。

import boto3 import json import base64 import io from PIL import Image bedrock = boto3.client('bedrock-runtime', region_name='us-west-2') file_path = 'input_image.png' image_bytes = open(file_path, "rb").read() base64_image = base64.b64encode(image_bytes).decode("utf-8") response = bedrock.invoke_model( modelId='stability.sd3-large-v1:0', body=json.dumps({ 'prompt': 'A car made out of fruits', 'image': base64_image, 'strength': 0.75, 'mode': 'image-to-image' }) ) output_body = json.loads(response["body"].read().decode("utf-8")) base64_output_image = output_body["images"][0] image_data = base64.b64decode(base64_output_image) image = Image.open(io.BytesIO(image_data)) image.save("output_image.png")

Stability.ai Stable Diffusion 3 Large 模型具有下列text-to-image推論呼叫的推論參數。

  • prompt – (字串) 您希望在輸出映像中看到的內容。強烈的描述性提示,明確定義元素、顏色和主題將帶來更好的結果。

    下限 最大

    0

    10,000

選用欄位

  • aspect_ratio – (字串) 控制產生影像的長寬比。此參數僅適用於text-to-image請求。預設 1:1。列舉:16:9、1:1、21:9、2:3、3:2、4:5、5:4、9:16、9:21。

  • 模式 – 控制這是text-to-image還是image-to-image產生,這會影響需要哪些參數。預設:text-to-image。列舉:image-to-imagetext-to-image

  • output_format – 指定輸出映像的格式。支援的格式:JPEG、PNG。支援的維度:高度 640 到 1,536 px,寬度 640 到 1,536 px。

  • seed – (number) 用來引導產生之「隨機度」的特定值。(省略此參數或傳遞 0 以使用隨機種子。) 範圍:0 到 4294967295。

  • negative_prompt – 您不希望在輸出影像中看到的關鍵字。上限:10.000 個字元。

import boto3 import json import base64 import io from PIL import Image bedrock = boto3.client('bedrock-runtime', region_name='us-west-2') response = bedrock.invoke_model( modelId='stability.sd3-large-v1:0', body=json.dumps({ 'prompt': 'A car made out of vegetables.' }) ) output_body = json.loads(response["body"].read().decode("utf-8")) base64_output_image = output_body["images"][0] image_data = base64.b64decode(base64_output_image) image = Image.open(io.BytesIO(image_data)) image.save("image.png")

在本頁面

隱私權網站條款Cookie 偏好設定
© 2025, Amazon Web Services, Inc.或其附屬公司。保留所有權利。