Skip to content

Commit 0cd1b4a

Browse files
committed
Add stablediffusion v3 example
1 parent b6bd167 commit 0cd1b4a

File tree

2 files changed

+64
-27
lines changed

2 files changed

+64
-27
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"id": {
3+
"S": "Default-Example-Image-Stability-Diffusion-v3"
4+
},
5+
"default": {
6+
"BOOL": true
7+
},
8+
"image": {
9+
"M": {
10+
"modelId": {
11+
"S": "stability.sd3-5-large-v1:0"
12+
},
13+
"parameters": {
14+
"M": {
15+
"mode": {
16+
"S": "text-to-image"
17+
},
18+
"aspect_ratio": {
19+
"S": "1:1"
20+
},
21+
"output_format": {
22+
"S": "jpeg"
23+
}
24+
}
25+
}
26+
}
27+
},
28+
"name": {
29+
"S": "Example Without People (Claude v4-5 Haiku & Stability Diffusion v3)"
30+
},
31+
"text": {
32+
"M": {
33+
"modelId": {
34+
"S": "eu.anthropic.claude-haiku-4-5-20251001-v1:0"
35+
},
36+
"parameters": {
37+
"M": {}
38+
},
39+
"prePrompt": {
40+
"S": "You're a prompt engineer, trying to design a prompt for Stable Diffusion, so it can generate a photographic image to illustrate the following text, showing no people in the image:"
41+
}
42+
}
43+
},
44+
"type": {
45+
"S": "image"
46+
}
47+
}

infrastructure/lib/features/readable/model.ts

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -96,36 +96,43 @@ export class dt_readableModel extends Construct {
9696
);
9797

9898
// EXAMPLE ENTRY
99-
// EXAMPLE ENTRY | TEXT
100-
const textModels = [
99+
const models = [
101100
{
102101
id: "exampleEntryText_claude_4-5_haiku",
103-
file: "./defaults/text.anthropic-claude-4-5-haiku.ddb.json"
102+
file: "./defaults/text.anthropic-claude-4-5-haiku.ddb.json",
104103
},
105104
{
106105
id: "exampleEntryText_mistral_7b_instruct",
107-
file: "./defaults/text.mistral-mistral-7b-instruct.ddb.json"
106+
file: "./defaults/text.mistral-mistral-7b-instruct.ddb.json",
108107
},
109108
{
110109
id: "exampleEntryText_amazon_nova_v1_pro",
111-
file: "./defaults/text.amazon-nova-v1-pro.ddb.json"
110+
file: "./defaults/text.amazon-nova-v1-pro.ddb.json",
112111
},
113112
{
114113
id: "exampleEntryText_amazon_nova_v2_lite",
115-
file: "./defaults/text.amazon-nova-v2-lite.ddb.json"
116-
}
114+
file: "./defaults/text.amazon-nova-v2-lite.ddb.json",
115+
},
116+
{
117+
id: "exampleEntryImage",
118+
file: "./defaults/image.stabilityai-stablediffusion.ddb.json",
119+
},
120+
{
121+
id: "exampleEntryImage_stabiltyai_stablediffusion-v3",
122+
file: "./defaults/image.stabilityai-stablediffusion-3.ddb.json",
123+
},
117124
];
118125

119-
textModels.forEach(model => {
126+
models.forEach((model) => {
120127
new cr.AwsCustomResource(this, model.id, {
121128
onCreate: {
122129
service: "DynamoDB",
123130
action: "putItem",
124131
parameters: {
125132
TableName: this.modelTable.tableName,
126-
Item: require(model.file),
133+
Item: require(model.file),
127134
},
128-
physicalResourceId: cr.PhysicalResourceId.of(model.id),
135+
physicalResourceId: cr.PhysicalResourceId.of(model.id),
129136
},
130137
policy: cr.AwsCustomResourcePolicy.fromSdkCalls({
131138
resources: [this.modelTable.tableArn],
@@ -134,23 +141,6 @@ export class dt_readableModel extends Construct {
134141
});
135142
});
136143

137-
// EXAMPLE ENTRY | IMAGE
138-
new cr.AwsCustomResource(this, "exampleEntryImage", {
139-
onCreate: {
140-
service: "DynamoDB",
141-
action: "putItem",
142-
parameters: {
143-
TableName: this.modelTable.tableName,
144-
Item: require("./defaults/image.stabilityai-stablediffusion.ddb.json"),
145-
},
146-
physicalResourceId: cr.PhysicalResourceId.of("exampleEntryImage"),
147-
},
148-
policy: cr.AwsCustomResourcePolicy.fromSdkCalls({
149-
resources: [this.modelTable.tableArn],
150-
}),
151-
installLatestAwsSdk: true,
152-
});
153-
154144
// EXAMPLE ENTRY | CUSTOM RESOURCE CDK LAMBDA
155145
NagSuppressions.addResourceSuppressionsByPath(
156146
cdk.Stack.of(this),

0 commit comments

Comments
 (0)