1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#[allow(unused_imports)]
use crate::prelude::*;
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[allow(unused_imports)]
use std::collections::HashMap;
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct HTTPValidationError {
#[serde(skip_serializing_if = "Option::is_none")]
pub detail: Option<Vec<Option<ValidationError>>>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Image {
#[serde(skip_serializing_if = "Option::is_none")]
pub content_type: Option<String>,
pub height: i64,
pub url: String,
pub width: i64,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ImageSize {
/// The height of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub height: Option<i64>,
/// The width of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub width: Option<i64>,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Output {
/// Whether the generated images contain NSFW concepts.
pub has_nsfw_concepts: Vec<bool>,
/// The generated image files info.
pub images: Vec<Image>,
/// The prompt used for generating the image.
pub prompt: String,
/// Seed of the generated Image. It will be the same value of the one passed in the
/// input or the randomly generated that was used in case none was passed.
pub seed: i64,
pub timings: Timings,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct SoteDiffusionInput {
/// If set to false, the safety checker will be disabled.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_safety_checker: Option<bool>,
/// Number of steps to run the first stage for.
#[serde(skip_serializing_if = "Option::is_none")]
pub first_stage_steps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The size of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub image_size: Option<ImageSizeProperty>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
/// "very displeasing, worst quality, monochrome, realistic, oldest"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "newest, extremely aesthetic, best quality, 1girl, solo, pink hair, blue eyes, long hair, looking at viewer, smile, black background, holding a sign, the text on the sign says \"Hello\""
pub prompt: String,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub second_stage_guidance_scale: Option<f64>,
/// Number of steps to run the second stage for.
#[serde(skip_serializing_if = "Option::is_none")]
pub second_stage_steps: Option<i64>,
/// The same seed and the same prompt given to the same version of Stable Cascade
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the image will be returned as base64 encoded string.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct StableCascadeInput {
/// If set to false, the safety checker will be disabled.
#[serde(skip_serializing_if = "Option::is_none")]
pub enable_safety_checker: Option<bool>,
/// Number of steps to run the first stage for.
#[serde(skip_serializing_if = "Option::is_none")]
pub first_stage_steps: Option<i64>,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub guidance_scale: Option<f64>,
/// The size of the generated image.
#[serde(skip_serializing_if = "Option::is_none")]
pub image_size: Option<ImageSizeProperty>,
/// The negative prompt to use. Use it to address details that you don't want
/// in the image. This could be colors, objects, scenery and even the small details
/// (e.g. moustache, blurry, low resolution).
/// "ugly, deformed"
#[serde(skip_serializing_if = "Option::is_none")]
pub negative_prompt: Option<String>,
/// The number of images to generate.
#[serde(skip_serializing_if = "Option::is_none")]
pub num_images: Option<i64>,
/// The prompt to use for generating the image. Be as descriptive as possible for best results.
/// "An image of a shiba inu, donning a spacesuit and helmet"
pub prompt: String,
/// The CFG (Classifier Free Guidance) scale is a measure of how close you want
/// the model to stick to your prompt when looking for a related image to show you.
#[serde(skip_serializing_if = "Option::is_none")]
pub second_stage_guidance_scale: Option<f64>,
/// Number of steps to run the second stage for.
#[serde(skip_serializing_if = "Option::is_none")]
pub second_stage_steps: Option<i64>,
/// The same seed and the same prompt given to the same version of Stable Cascade
/// will output the same image every time.
#[serde(skip_serializing_if = "Option::is_none")]
pub seed: Option<i64>,
/// If set to true, the image will be returned as base64 encoded string.
#[serde(skip_serializing_if = "Option::is_none")]
pub sync_mode: Option<bool>,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct ValidationError {
pub loc: Vec<serde_json::Value>,
pub msg: String,
#[serde(rename = "type")]
pub ty: String,
}
#[derive(Debug, Serialize, Deserialize, smart_default::SmartDefault)]
#[allow(non_camel_case_types)]
pub enum ImageSizeProperty {
#[default]
ImageSize(ImageSize),
#[serde(rename = "square_hd")]
SquareHd,
#[serde(rename = "square")]
Square,
#[serde(rename = "portrait_4_3")]
Portrait43,
#[serde(rename = "portrait_16_9")]
Portrait169,
#[serde(rename = "landscape_4_3")]
Landscape43,
#[serde(rename = "landscape_16_9")]
Landscape169,
}
#[derive(Debug, Serialize, Deserialize, Default)]
pub struct Timings {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "type")]
pub ty: Option<serde_json::Value>,
}
/// Stable Cascade
///
/// Category: text-to-image
/// Machine Type: A100
/// License Type: research
pub fn sote_diffusion(params: SoteDiffusionInput) -> FalRequest<SoteDiffusionInput, Output> {
FalRequest::new("fal-ai/stable-cascade/sote-diffusion", params)
}