@@ -229,44 +229,41 @@ def list(cls, args):
229
229
print (file )
230
230
231
231
232
- class DALLE :
232
+ class Image :
233
233
@classmethod
234
- def generations (cls , args ):
235
- resp = openai .DALLE . generations (
234
+ def create (cls , args ):
235
+ resp = openai .Image . create (
236
236
prompt = args .prompt ,
237
- model = args .model ,
238
237
size = args .size ,
239
- num_images = args .num_images ,
238
+ n = args .num_images ,
240
239
response_format = args .response_format ,
241
240
)
242
241
print (resp )
243
242
244
243
@classmethod
245
- def variations (cls , args ):
244
+ def create_variation (cls , args ):
246
245
with open (args .image , "rb" ) as file_reader :
247
246
buffer_reader = BufferReader (file_reader .read (), desc = "Upload progress" )
248
- resp = openai .DALLE . variations (
247
+ resp = openai .Image . create_variation (
249
248
image = buffer_reader ,
250
- model = args .model ,
251
249
size = args .size ,
252
- num_images = args .num_images ,
250
+ n = args .num_images ,
253
251
response_format = args .response_format ,
254
252
)
255
253
print (resp )
256
254
257
255
@classmethod
258
- def edits (cls , args ):
256
+ def create_edit (cls , args ):
259
257
with open (args .image , "rb" ) as file_reader :
260
258
image_reader = BufferReader (file_reader .read (), desc = "Upload progress" )
261
259
with open (args .mask , "rb" ) as file_reader :
262
260
mask_reader = BufferReader (file_reader .read (), desc = "Upload progress" )
263
- resp = openai .DALLE . edits (
261
+ resp = openai .Image . create_edit (
264
262
image = image_reader ,
265
263
mask = mask_reader ,
266
264
prompt = args .prompt ,
267
- model = args .model ,
268
265
size = args .size ,
269
- num_images = args .num_images ,
266
+ n = args .num_images ,
270
267
response_format = args .response_format ,
271
268
)
272
269
print (resp )
@@ -1026,19 +1023,17 @@ def help(args):
1026
1023
sub .add_argument ("-i" , "--id" , required = True , help = "The id of the fine-tune job" )
1027
1024
sub .set_defaults (func = FineTune .cancel )
1028
1025
1029
- # DALLE
1030
- sub = subparsers .add_parser ("dalle.generations" )
1031
- sub .add_argument ("-m" , "--model" , type = str , default = "image-alpha-001" )
1026
+ # Image
1027
+ sub = subparsers .add_parser ("image.create" )
1032
1028
sub .add_argument ("-p" , "--prompt" , type = str , required = True )
1033
1029
sub .add_argument ("-n" , "--num-images" , type = int , default = 1 )
1034
1030
sub .add_argument (
1035
1031
"-s" , "--size" , type = str , default = "1024x1024" , help = "Size of the output image"
1036
1032
)
1037
1033
sub .add_argument ("--response-format" , type = str , default = "url" )
1038
- sub .set_defaults (func = DALLE . generations )
1034
+ sub .set_defaults (func = Image . create )
1039
1035
1040
- sub = subparsers .add_parser ("dalle.edits" )
1041
- sub .add_argument ("-m" , "--model" , type = str , default = "image-alpha-001" )
1036
+ sub = subparsers .add_parser ("image.create_edit" )
1042
1037
sub .add_argument ("-p" , "--prompt" , type = str , required = True )
1043
1038
sub .add_argument ("-n" , "--num-images" , type = int , default = 1 )
1044
1039
sub .add_argument (
@@ -1059,10 +1054,9 @@ def help(args):
1059
1054
required = True ,
1060
1055
help = "Path to a mask image. It should be the same size as the image you're editing and a RGBA PNG image. The Alpha channel acts as the mask." ,
1061
1056
)
1062
- sub .set_defaults (func = DALLE . edits )
1057
+ sub .set_defaults (func = Image . create_edit )
1063
1058
1064
- sub = subparsers .add_parser ("dalle.variations" )
1065
- sub .add_argument ("-m" , "--model" , type = str , default = "image-alpha-001" )
1059
+ sub = subparsers .add_parser ("image.create_variation" )
1066
1060
sub .add_argument ("-n" , "--num-images" , type = int , default = 1 )
1067
1061
sub .add_argument (
1068
1062
"-I" ,
@@ -1075,7 +1069,7 @@ def help(args):
1075
1069
"-s" , "--size" , type = str , default = "1024x1024" , help = "Size of the output image"
1076
1070
)
1077
1071
sub .add_argument ("--response-format" , type = str , default = "url" )
1078
- sub .set_defaults (func = DALLE . variations )
1072
+ sub .set_defaults (func = Image . create_variation )
1079
1073
1080
1074
1081
1075
def wandb_register (parser ):
0 commit comments