@@ -229,44 +229,41 @@ def list(cls, args):
229229 print (file )
230230
231231
232- class DALLE :
232+ class Image :
233233 @classmethod
234- def generations (cls , args ):
235- resp = openai .DALLE . generations (
234+ def create (cls , args ):
235+ resp = openai .Image . create (
236236 prompt = args .prompt ,
237- model = args .model ,
238237 size = args .size ,
239- num_images = args .num_images ,
238+ n = args .num_images ,
240239 response_format = args .response_format ,
241240 )
242241 print (resp )
243242
244243 @classmethod
245- def variations (cls , args ):
244+ def create_variation (cls , args ):
246245 with open (args .image , "rb" ) as file_reader :
247246 buffer_reader = BufferReader (file_reader .read (), desc = "Upload progress" )
248- resp = openai .DALLE . variations (
247+ resp = openai .Image . create_variation (
249248 image = buffer_reader ,
250- model = args .model ,
251249 size = args .size ,
252- num_images = args .num_images ,
250+ n = args .num_images ,
253251 response_format = args .response_format ,
254252 )
255253 print (resp )
256254
257255 @classmethod
258- def edits (cls , args ):
256+ def create_edit (cls , args ):
259257 with open (args .image , "rb" ) as file_reader :
260258 image_reader = BufferReader (file_reader .read (), desc = "Upload progress" )
261259 with open (args .mask , "rb" ) as file_reader :
262260 mask_reader = BufferReader (file_reader .read (), desc = "Upload progress" )
263- resp = openai .DALLE . edits (
261+ resp = openai .Image . create_edit (
264262 image = image_reader ,
265263 mask = mask_reader ,
266264 prompt = args .prompt ,
267- model = args .model ,
268265 size = args .size ,
269- num_images = args .num_images ,
266+ n = args .num_images ,
270267 response_format = args .response_format ,
271268 )
272269 print (resp )
@@ -1026,19 +1023,17 @@ def help(args):
10261023 sub .add_argument ("-i" , "--id" , required = True , help = "The id of the fine-tune job" )
10271024 sub .set_defaults (func = FineTune .cancel )
10281025
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" )
10321028 sub .add_argument ("-p" , "--prompt" , type = str , required = True )
10331029 sub .add_argument ("-n" , "--num-images" , type = int , default = 1 )
10341030 sub .add_argument (
10351031 "-s" , "--size" , type = str , default = "1024x1024" , help = "Size of the output image"
10361032 )
10371033 sub .add_argument ("--response-format" , type = str , default = "url" )
1038- sub .set_defaults (func = DALLE . generations )
1034+ sub .set_defaults (func = Image . create )
10391035
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" )
10421037 sub .add_argument ("-p" , "--prompt" , type = str , required = True )
10431038 sub .add_argument ("-n" , "--num-images" , type = int , default = 1 )
10441039 sub .add_argument (
@@ -1059,10 +1054,9 @@ def help(args):
10591054 required = True ,
10601055 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." ,
10611056 )
1062- sub .set_defaults (func = DALLE . edits )
1057+ sub .set_defaults (func = Image . create_edit )
10631058
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" )
10661060 sub .add_argument ("-n" , "--num-images" , type = int , default = 1 )
10671061 sub .add_argument (
10681062 "-I" ,
@@ -1075,7 +1069,7 @@ def help(args):
10751069 "-s" , "--size" , type = str , default = "1024x1024" , help = "Size of the output image"
10761070 )
10771071 sub .add_argument ("--response-format" , type = str , default = "url" )
1078- sub .set_defaults (func = DALLE . variations )
1072+ sub .set_defaults (func = Image . create_variation )
10791073
10801074
10811075def wandb_register (parser ):
0 commit comments