This repository has been archived by the owner on Aug 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
model_text_to_image_params.go
496 lines (416 loc) · 13.2 KB
/
model_text_to_image_params.go
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
/*
Livepeer AI Runner
An application to run AI pipelines
API version: 0.1.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package livepeer_ai
import (
"encoding/json"
"bytes"
"fmt"
)
// checks if the TextToImageParams type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &TextToImageParams{}
// TextToImageParams struct for TextToImageParams
type TextToImageParams struct {
ModelId string `json:"model_id"`
Prompt string `json:"prompt"`
Height *int32 `json:"height,omitempty"`
Width *int32 `json:"width,omitempty"`
GuidanceScale *float32 `json:"guidance_scale,omitempty"`
NegativePrompt *string `json:"negative_prompt,omitempty"`
SafetyCheck *bool `json:"safety_check,omitempty"`
Seed *int32 `json:"seed,omitempty"`
NumInferenceSteps *int32 `json:"num_inference_steps,omitempty"`
NumImagesPerPrompt *int32 `json:"num_images_per_prompt,omitempty"`
}
type _TextToImageParams TextToImageParams
// NewTextToImageParams instantiates a new TextToImageParams object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewTextToImageParams(modelId string, prompt string) *TextToImageParams {
this := TextToImageParams{}
this.ModelId = modelId
this.Prompt = prompt
var guidanceScale float32 = 7.5
this.GuidanceScale = &guidanceScale
var negativePrompt string = ""
this.NegativePrompt = &negativePrompt
var safetyCheck bool = true
this.SafetyCheck = &safetyCheck
var numInferenceSteps int32 = 50
this.NumInferenceSteps = &numInferenceSteps
var numImagesPerPrompt int32 = 1
this.NumImagesPerPrompt = &numImagesPerPrompt
return &this
}
// NewTextToImageParamsWithDefaults instantiates a new TextToImageParams object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewTextToImageParamsWithDefaults() *TextToImageParams {
this := TextToImageParams{}
var modelId string = ""
this.ModelId = modelId
var guidanceScale float32 = 7.5
this.GuidanceScale = &guidanceScale
var negativePrompt string = ""
this.NegativePrompt = &negativePrompt
var safetyCheck bool = true
this.SafetyCheck = &safetyCheck
var numInferenceSteps int32 = 50
this.NumInferenceSteps = &numInferenceSteps
var numImagesPerPrompt int32 = 1
this.NumImagesPerPrompt = &numImagesPerPrompt
return &this
}
// GetModelId returns the ModelId field value
func (o *TextToImageParams) GetModelId() string {
if o == nil {
var ret string
return ret
}
return o.ModelId
}
// GetModelIdOk returns a tuple with the ModelId field value
// and a boolean to check if the value has been set.
func (o *TextToImageParams) GetModelIdOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.ModelId, true
}
// SetModelId sets field value
func (o *TextToImageParams) SetModelId(v string) {
o.ModelId = v
}
// GetPrompt returns the Prompt field value
func (o *TextToImageParams) GetPrompt() string {
if o == nil {
var ret string
return ret
}
return o.Prompt
}
// GetPromptOk returns a tuple with the Prompt field value
// and a boolean to check if the value has been set.
func (o *TextToImageParams) GetPromptOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Prompt, true
}
// SetPrompt sets field value
func (o *TextToImageParams) SetPrompt(v string) {
o.Prompt = v
}
// GetHeight returns the Height field value if set, zero value otherwise.
func (o *TextToImageParams) GetHeight() int32 {
if o == nil || IsNil(o.Height) {
var ret int32
return ret
}
return *o.Height
}
// GetHeightOk returns a tuple with the Height field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TextToImageParams) GetHeightOk() (*int32, bool) {
if o == nil || IsNil(o.Height) {
return nil, false
}
return o.Height, true
}
// HasHeight returns a boolean if a field has been set.
func (o *TextToImageParams) HasHeight() bool {
if o != nil && !IsNil(o.Height) {
return true
}
return false
}
// SetHeight gets a reference to the given int32 and assigns it to the Height field.
func (o *TextToImageParams) SetHeight(v int32) {
o.Height = &v
}
// GetWidth returns the Width field value if set, zero value otherwise.
func (o *TextToImageParams) GetWidth() int32 {
if o == nil || IsNil(o.Width) {
var ret int32
return ret
}
return *o.Width
}
// GetWidthOk returns a tuple with the Width field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TextToImageParams) GetWidthOk() (*int32, bool) {
if o == nil || IsNil(o.Width) {
return nil, false
}
return o.Width, true
}
// HasWidth returns a boolean if a field has been set.
func (o *TextToImageParams) HasWidth() bool {
if o != nil && !IsNil(o.Width) {
return true
}
return false
}
// SetWidth gets a reference to the given int32 and assigns it to the Width field.
func (o *TextToImageParams) SetWidth(v int32) {
o.Width = &v
}
// GetGuidanceScale returns the GuidanceScale field value if set, zero value otherwise.
func (o *TextToImageParams) GetGuidanceScale() float32 {
if o == nil || IsNil(o.GuidanceScale) {
var ret float32
return ret
}
return *o.GuidanceScale
}
// GetGuidanceScaleOk returns a tuple with the GuidanceScale field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TextToImageParams) GetGuidanceScaleOk() (*float32, bool) {
if o == nil || IsNil(o.GuidanceScale) {
return nil, false
}
return o.GuidanceScale, true
}
// HasGuidanceScale returns a boolean if a field has been set.
func (o *TextToImageParams) HasGuidanceScale() bool {
if o != nil && !IsNil(o.GuidanceScale) {
return true
}
return false
}
// SetGuidanceScale gets a reference to the given float32 and assigns it to the GuidanceScale field.
func (o *TextToImageParams) SetGuidanceScale(v float32) {
o.GuidanceScale = &v
}
// GetNegativePrompt returns the NegativePrompt field value if set, zero value otherwise.
func (o *TextToImageParams) GetNegativePrompt() string {
if o == nil || IsNil(o.NegativePrompt) {
var ret string
return ret
}
return *o.NegativePrompt
}
// GetNegativePromptOk returns a tuple with the NegativePrompt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TextToImageParams) GetNegativePromptOk() (*string, bool) {
if o == nil || IsNil(o.NegativePrompt) {
return nil, false
}
return o.NegativePrompt, true
}
// HasNegativePrompt returns a boolean if a field has been set.
func (o *TextToImageParams) HasNegativePrompt() bool {
if o != nil && !IsNil(o.NegativePrompt) {
return true
}
return false
}
// SetNegativePrompt gets a reference to the given string and assigns it to the NegativePrompt field.
func (o *TextToImageParams) SetNegativePrompt(v string) {
o.NegativePrompt = &v
}
// GetSafetyCheck returns the SafetyCheck field value if set, zero value otherwise.
func (o *TextToImageParams) GetSafetyCheck() bool {
if o == nil || IsNil(o.SafetyCheck) {
var ret bool
return ret
}
return *o.SafetyCheck
}
// GetSafetyCheckOk returns a tuple with the SafetyCheck field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TextToImageParams) GetSafetyCheckOk() (*bool, bool) {
if o == nil || IsNil(o.SafetyCheck) {
return nil, false
}
return o.SafetyCheck, true
}
// HasSafetyCheck returns a boolean if a field has been set.
func (o *TextToImageParams) HasSafetyCheck() bool {
if o != nil && !IsNil(o.SafetyCheck) {
return true
}
return false
}
// SetSafetyCheck gets a reference to the given bool and assigns it to the SafetyCheck field.
func (o *TextToImageParams) SetSafetyCheck(v bool) {
o.SafetyCheck = &v
}
// GetSeed returns the Seed field value if set, zero value otherwise.
func (o *TextToImageParams) GetSeed() int32 {
if o == nil || IsNil(o.Seed) {
var ret int32
return ret
}
return *o.Seed
}
// GetSeedOk returns a tuple with the Seed field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TextToImageParams) GetSeedOk() (*int32, bool) {
if o == nil || IsNil(o.Seed) {
return nil, false
}
return o.Seed, true
}
// HasSeed returns a boolean if a field has been set.
func (o *TextToImageParams) HasSeed() bool {
if o != nil && !IsNil(o.Seed) {
return true
}
return false
}
// SetSeed gets a reference to the given int32 and assigns it to the Seed field.
func (o *TextToImageParams) SetSeed(v int32) {
o.Seed = &v
}
// GetNumInferenceSteps returns the NumInferenceSteps field value if set, zero value otherwise.
func (o *TextToImageParams) GetNumInferenceSteps() int32 {
if o == nil || IsNil(o.NumInferenceSteps) {
var ret int32
return ret
}
return *o.NumInferenceSteps
}
// GetNumInferenceStepsOk returns a tuple with the NumInferenceSteps field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TextToImageParams) GetNumInferenceStepsOk() (*int32, bool) {
if o == nil || IsNil(o.NumInferenceSteps) {
return nil, false
}
return o.NumInferenceSteps, true
}
// HasNumInferenceSteps returns a boolean if a field has been set.
func (o *TextToImageParams) HasNumInferenceSteps() bool {
if o != nil && !IsNil(o.NumInferenceSteps) {
return true
}
return false
}
// SetNumInferenceSteps gets a reference to the given int32 and assigns it to the NumInferenceSteps field.
func (o *TextToImageParams) SetNumInferenceSteps(v int32) {
o.NumInferenceSteps = &v
}
// GetNumImagesPerPrompt returns the NumImagesPerPrompt field value if set, zero value otherwise.
func (o *TextToImageParams) GetNumImagesPerPrompt() int32 {
if o == nil || IsNil(o.NumImagesPerPrompt) {
var ret int32
return ret
}
return *o.NumImagesPerPrompt
}
// GetNumImagesPerPromptOk returns a tuple with the NumImagesPerPrompt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *TextToImageParams) GetNumImagesPerPromptOk() (*int32, bool) {
if o == nil || IsNil(o.NumImagesPerPrompt) {
return nil, false
}
return o.NumImagesPerPrompt, true
}
// HasNumImagesPerPrompt returns a boolean if a field has been set.
func (o *TextToImageParams) HasNumImagesPerPrompt() bool {
if o != nil && !IsNil(o.NumImagesPerPrompt) {
return true
}
return false
}
// SetNumImagesPerPrompt gets a reference to the given int32 and assigns it to the NumImagesPerPrompt field.
func (o *TextToImageParams) SetNumImagesPerPrompt(v int32) {
o.NumImagesPerPrompt = &v
}
func (o TextToImageParams) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o TextToImageParams) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["model_id"] = o.ModelId
toSerialize["prompt"] = o.Prompt
if !IsNil(o.Height) {
toSerialize["height"] = o.Height
}
if !IsNil(o.Width) {
toSerialize["width"] = o.Width
}
if !IsNil(o.GuidanceScale) {
toSerialize["guidance_scale"] = o.GuidanceScale
}
if !IsNil(o.NegativePrompt) {
toSerialize["negative_prompt"] = o.NegativePrompt
}
if !IsNil(o.SafetyCheck) {
toSerialize["safety_check"] = o.SafetyCheck
}
if !IsNil(o.Seed) {
toSerialize["seed"] = o.Seed
}
if !IsNil(o.NumInferenceSteps) {
toSerialize["num_inference_steps"] = o.NumInferenceSteps
}
if !IsNil(o.NumImagesPerPrompt) {
toSerialize["num_images_per_prompt"] = o.NumImagesPerPrompt
}
return toSerialize, nil
}
func (o *TextToImageParams) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"model_id",
"prompt",
}
allProperties := make(map[string]interface{})
err = json.Unmarshal(data, &allProperties)
if err != nil {
return err;
}
for _, requiredProperty := range(requiredProperties) {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
varTextToImageParams := _TextToImageParams{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varTextToImageParams)
if err != nil {
return err
}
*o = TextToImageParams(varTextToImageParams)
return err
}
type NullableTextToImageParams struct {
value *TextToImageParams
isSet bool
}
func (v NullableTextToImageParams) Get() *TextToImageParams {
return v.value
}
func (v *NullableTextToImageParams) Set(val *TextToImageParams) {
v.value = val
v.isSet = true
}
func (v NullableTextToImageParams) IsSet() bool {
return v.isSet
}
func (v *NullableTextToImageParams) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTextToImageParams(val *TextToImageParams) *NullableTextToImageParams {
return &NullableTextToImageParams{value: val, isSet: true}
}
func (v NullableTextToImageParams) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableTextToImageParams) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}