@@ -133,26 +133,18 @@ async def gen_img(self, ctx, *args):
133133
134134 @commands .command (pass_context = True , aliases = ["editimg" , "editimage" , "edit_image" ],
135135 brief = "edit an image from a prompt using openai" )
136- < << << << HEAD
137- async def edit_img (self , ctx ):
138- == == == =
139136 @commands .cooldown (1 , 60 , commands .BucketType .user )
140137 async def edit_img (self , ctx , * args ):
141- >> >> >> > f372db8 (Fix critical bugs and security issues from code review )
142138 """
143139 Edit an image from a prompt using openai
144140 :arg ctx: Context
145141 :return: None
146142 """
147143
148- << << << < HEAD
149144 if not blacklisted (ctx .author ):
150- == == == =
151- if not blackisted (ctx .author ):
152145 if not ctx .message .attachments :
153146 await ctx .send ("No image attached" )
154147 return
155- > >> >> >> f372db8 (Fix critical bugs and security issues from code review )
156148 if ctx .message .attachments [0 ] is None :
157149 await ctx .send ("No image attached" )
158150 return
@@ -164,27 +156,12 @@ async def edit_img(self, ctx, *args):
164156 png = png .resize ((1024 , 1024 ))
165157 png .save ("temp.png" , 'png' , quality = 100 )
166158 settings .logger .info (f"editing image" )
167- << << << < HEAD
168- response = self .openai_client .images .create_variation (
169- image = open ("temp.png" , "rb" ),
170- n = 1 ,
171- size = "1024x1024"
172- )
173- == == == =
174- # response = openai.Image.create_edit(
175- # image=open("temp.png", "rb"),
176- # mask=open("mask.png", "rb"),
177- # prompt=prompt,
178- # n=1,
179- # size="1024x1024"
180- # )
181159 with open ("temp.png" , "rb" ) as image_file :
182160 response = self .openai_client .images .create_variation (
183161 image = image_file ,
184162 n = 1 ,
185163 size = "1024x1024"
186164 )
187- >> >> >> > f372db8 (Fix critical bugs and security issues from code review )
188165 os .remove ("temp.png" )
189166 image_url = response ['data' ][0 ]['url' ]
190167 image_filename = wget .download (image_url )
@@ -452,7 +429,6 @@ async def chat_assistant(self, ctx, name, *args):
452429 run_id = run .id
453430 )
454431
455- << << << < HEAD
456432 current_time = time .time ()
457433 if current_time - start_time > 60 :
458434 # TODO: if the assistant times out, deduct from the user's usage, then cancel the run
@@ -467,11 +443,7 @@ async def chat_assistant(self, ctx, name, *args):
467443 await ctx .send ("Error cancelling assistant run" )
468444 return
469445
470- if "completed" in run .status :
471- == == == =
472446 if run .status == "completed" :
473- # await ctx.send("Assistant complete")
474- > >> >> >> f372db8 (Fix critical bugs and security issues from code review )
475447 break
476448 elif run .status == "queued" :
477449 pass
0 commit comments