mirror of
https://github.com/father-bot/chatgpt_telegram_bot.git
synced 2026-08-03 13:27:16 +03:00
Switch image generation to DALL-E 3
Use the dall-e-3 model in generate_images and default to 1024x1024. dall-e-3 only supports n=1, so request a single image per call.
This commit is contained in:
+5
-2
@@ -341,8 +341,11 @@ async def transcribe_audio(audio_file) -> str:
|
||||
return r.text or ""
|
||||
|
||||
|
||||
async def generate_images(prompt, n_images=4, size="512x512"):
|
||||
r = await openai_client.images.generate(prompt=prompt, n=n_images, size=size)
|
||||
async def generate_images(prompt, n_images=1, size="1024x1024"):
|
||||
# dall-e-3 only supports generating one image per request
|
||||
r = await openai_client.images.generate(
|
||||
model="dall-e-3", prompt=prompt, n=1, size=size
|
||||
)
|
||||
image_urls = [item.url for item in r.data]
|
||||
return image_urls
|
||||
|
||||
|
||||
Reference in New Issue
Block a user