Open mithew opened 12 months ago
I think its under open_utils.py
Since no model is listed it defaults to dalle-2
async def generate_images(prompt, n_images=4, size="512x512"): r = await openai.Image.acreate(prompt=prompt, n=n_images, size=size) image_urls = [item.url for item in r.data] return image_urls
change it to
async def generate_images(prompt, n_images=1, size="1024x1024"):
r = await openai.Image.acreate(model="dall-e-3", prompt=prompt, n=1, size=1024x1024)
image_urls = [item.url for item in r.data]
return image_urls
Here is the link to the API example https://platform.openai.com/docs/guides/images/usage?context=node Do note that there are some defaults
I changed the configuration file to DALL-E 3, but the final drawing API still calls DALL-E 2, which is strange.
@mithew Can you please let us know your openai
version? It's set at requirements.txt
.
@TerminalTorture , I believe the site you attached is based on the latest version which is 1.3.5
, but the version used in this repo is 0.28.1
.
# bot/openai_util.py
async def generate_images(prompt, n_images=4, size="512x512"):
r = await openai.Image.acreate(prompt=prompt, n=n_images, size=size)
image_urls = [item.url for item in r.data]
return image_urls
# openai/api_resources/image.py/Image
@classmethod
async def acreate(
cls,
api_key=None,
api_base=None,
api_type=None,
api_version=None,
organization=None,
**params
):
# bla bla bla
async def generate_images(prompt, n_images=1, size="1024x1024"):
r = await openai.Image.acreate(model="dall-e-3", prompt=prompt, n=n_images, size=size)
image_urls = [item.url for item in r.data]
return image_urls
Running on version Open AI 0.28.1
async def generate_images(prompt, n_images=1, size="1024x1024"): r = await openai.Image.acreate(model="dall-e-3", prompt=prompt, n=n_images, size=size) image_urls = [item.url for item in r.data] return image_urls
Running on version Open AI 0.28.1
Cool. It works for me too. Thanks!
async def generate_images(prompt, n_images=1, size="1024x1024"): r = await openai.Image.acreate(model="dall-e-3", prompt=prompt, n=n_images, size=size) image_urls = [item.url for item in r.data] return image_urls
Running on version Open AI 0.28.1
Success, thank you very much
async def generate_images(prompt, n_images=1, size="1024x1024"): r = await openai.Image.acreate(model="dall-e-3", prompt=prompt, n=n_images, size=size) image_urls = [item.url for item in r.data] return image_urls
Running on version Open AI 0.28.1
😄Do you know how to write code that can integrate this project with the OpenAI GPT-4 vision API?
async def generate_images(prompt, n_images=1, size="1024x1024"): r = await openai.Image.acreate(model="dall-e-3", prompt=prompt, n=n_images, size=size) image_urls = [item.url for item in r.data] return image_urls
Running on version Open AI 0.28.1
😄Do you know how to write code that can integrate this project with the OpenAI GPT-4 vision API?
Why don't you post it as a new issue. As far as I am aware, currently gpt-4-1106-vision-preview
is not available at Playground.
I changed the configuration file to DALL-E 3, but the final drawing API still calls DALL-E 2, which is strange.