@@ -241,13 +241,28 @@ async def run_model(
241
241
# Use V3 endpoint for V3 model, legacy endpoint for others
242
242
if model_name == "V_3" :
243
243
return await self ._run_model_v3 (
244
- api_key , prompt , seed , aspect_ratio , magic_prompt_option ,
245
- style_type , negative_prompt , color_palette_name , custom_colors
244
+ api_key ,
245
+ prompt ,
246
+ seed ,
247
+ aspect_ratio ,
248
+ magic_prompt_option ,
249
+ style_type ,
250
+ negative_prompt ,
251
+ color_palette_name ,
252
+ custom_colors ,
246
253
)
247
254
else :
248
255
return await self ._run_model_legacy (
249
- api_key , model_name , prompt , seed , aspect_ratio , magic_prompt_option ,
250
- style_type , negative_prompt , color_palette_name , custom_colors
256
+ api_key ,
257
+ model_name ,
258
+ prompt ,
259
+ seed ,
260
+ aspect_ratio ,
261
+ magic_prompt_option ,
262
+ style_type ,
263
+ negative_prompt ,
264
+ color_palette_name ,
265
+ custom_colors ,
251
266
)
252
267
253
268
async def _run_model_v3 (
@@ -271,11 +286,11 @@ async def _run_model_v3(
271
286
# Map legacy aspect ratio values to V3 format
272
287
aspect_ratio_map = {
273
288
"ASPECT_10_16" : "10x16" ,
274
- "ASPECT_16_10" : "16x10" ,
289
+ "ASPECT_16_10" : "16x10" ,
275
290
"ASPECT_9_16" : "9x16" ,
276
291
"ASPECT_16_9" : "16x9" ,
277
292
"ASPECT_3_2" : "3x2" ,
278
- "ASPECT_2_3" : "2x3" ,
293
+ "ASPECT_2_3" : "2x3" ,
279
294
"ASPECT_4_3" : "4x3" ,
280
295
"ASPECT_3_4" : "3x4" ,
281
296
"ASPECT_1_1" : "1x1" ,
@@ -284,11 +299,13 @@ async def _run_model_v3(
284
299
# Additional V3 supported ratios
285
300
"ASPECT_1_2" : "1x2" ,
286
301
"ASPECT_2_1" : "2x1" ,
287
- "ASPECT_4_5" : "4x5" ,
302
+ "ASPECT_4_5" : "4x5" ,
288
303
"ASPECT_5_4" : "5x4" ,
289
304
}
290
-
291
- v3_aspect_ratio = aspect_ratio_map .get (aspect_ratio , "1x1" ) # Default to 1x1 if not found
305
+
306
+ v3_aspect_ratio = aspect_ratio_map .get (
307
+ aspect_ratio , "1x1"
308
+ ) # Default to 1x1 if not found
292
309
293
310
# Use JSON for V3 endpoint (simpler than multipart/form-data)
294
311
data : Dict [str , Any ] = {
@@ -306,7 +323,7 @@ async def _run_model_v3(
306
323
307
324
# Note: V3 endpoint may have different color palette support
308
325
# For now, we'll omit color palettes for V3 to avoid errors
309
-
326
+
310
327
try :
311
328
response = await Requests ().post (url , headers = headers , json = data )
312
329
return response .json ()["data" ][0 ]["url" ]
0 commit comments