Skip to content

Commit fe552dc

Browse files
coffee-mugfurrypet
andauthored
Workers AI - Add seed parameter doc to Flux-1-model (#21361)
* Workers AI - Add seed parameter doc to Flux-1-model * Revert changes to json schema - handled automatically by API --------- Co-authored-by: Lucas Kostka <[email protected]>
1 parent 7ed8026 commit fe552dc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/models/code/Flux-1-Schnell.astro

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export default {
2020
async fetch(request, env): Promise<Response> {
2121
const response = await env.AI.run('@cf/black-forest-labs/flux-1-schnell', {
2222
prompt: 'a cyberpunk lizard',
23+
seed: Math.floor(Math.random() * 10)
2324
});
2425
// response.image is base64 encoded which can be used directly as an <img src=""> data URI
2526
const dataURI = \`data:image/jpeg;charset=utf-8;base64,\${response.image}\`;
@@ -38,6 +39,7 @@ export default {
3839
async fetch(request, env): Promise<Response> {
3940
const response = await env.AI.run('@cf/black-forest-labs/flux-1-schnell', {
4041
prompt: 'a cyberpunk lizard',
42+
seed: Math.floor(Math.random() * 10)
4143
});
4244
// Convert from base64 string
4345
const binaryString = atob(response.image);
@@ -56,7 +58,7 @@ const curl = `
5658
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run/${name} \\
5759
-X POST \\
5860
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \\
59-
-d '{ "prompt": "cyberpunk cat" }'
61+
-d '{ "prompt": "cyberpunk cat", "seed": "Random positive integer" }'
6062
`;
6163
---
6264

0 commit comments

Comments
 (0)