Skip to content

Commit 1701fac

Browse files
Wauplinpcuenca
andauthored
Add seed in text to image specs (#888)
Following @apolinario's PR huggingface/api-inference-community#450. This PR adds a "seed" input parameter in the `text-to-image` specs. --------- Co-authored-by: Pedro Cuenca <[email protected]>
1 parent 82d8224 commit 1701fac

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

packages/tasks/src/tasks/text-to-image/inference.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,27 @@ export interface TextToImageInput {
2626
*/
2727
export interface TextToImageParameters {
2828
/**
29-
* For diffusion models. A higher guidance scale value encourages the model to generate
30-
* images closely linked to the text prompt at the expense of lower image quality.
29+
* A higher guidance scale value encourages the model to generate images closely linked to
30+
* the text prompt, but values too high may cause saturation and other artifacts.
3131
*/
3232
guidance_scale?: number;
3333
/**
3434
* One or several prompt to guide what NOT to include in image generation.
3535
*/
3636
negative_prompt?: string[];
3737
/**
38-
* For diffusion models. The number of denoising steps. More denoising steps usually lead to
39-
* a higher quality image at the expense of slower inference.
38+
* The number of denoising steps. More denoising steps usually lead to a higher quality
39+
* image at the expense of slower inference.
4040
*/
4141
num_inference_steps?: number;
4242
/**
43-
* For diffusion models. Override the scheduler with a compatible one
43+
* Override the scheduler with a compatible one.
4444
*/
4545
scheduler?: string;
46+
/**
47+
* Seed for the random number generator.
48+
*/
49+
seed?: number;
4650
/**
4751
* The size in pixel of the output image
4852
*/

packages/tasks/src/tasks/text-to-image/spec/input.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"properties": {
2323
"guidance_scale": {
2424
"type": "number",
25-
"description": "For diffusion models. A higher guidance scale value encourages the model to generate images closely linked to the text prompt at the expense of lower image quality."
25+
"description": "A higher guidance scale value encourages the model to generate images closely linked to the text prompt, but values too high may cause saturation and other artifacts."
2626
},
2727
"negative_prompt": {
2828
"type": "array",
@@ -33,7 +33,7 @@
3333
},
3434
"num_inference_steps": {
3535
"type": "integer",
36-
"description": "For diffusion models. The number of denoising steps. More denoising steps usually lead to a higher quality image at the expense of slower inference."
36+
"description": "The number of denoising steps. More denoising steps usually lead to a higher quality image at the expense of slower inference."
3737
},
3838
"target_size": {
3939
"type": "object",
@@ -50,7 +50,11 @@
5050
},
5151
"scheduler": {
5252
"type": "string",
53-
"description": "For diffusion models. Override the scheduler with a compatible one"
53+
"description": "Override the scheduler with a compatible one."
54+
},
55+
"seed": {
56+
"type": "integer",
57+
"description": "Seed for the random number generator."
5458
}
5559
}
5660
}

0 commit comments

Comments
 (0)