Skip to content

Instantly share code, notes, and snippets.

@tiny-rawr
Last active January 29, 2024 07:27
Show Gist options
  • Save tiny-rawr/ad523bcf3fbe0e2781c81567eec3daf3 to your computer and use it in GitHub Desktop.
Save tiny-rawr/ad523bcf3fbe0e2781c81567eec3daf3 to your computer and use it in GitHub Desktop.
Generate a custom character image with OpenAI's DALLE 3
from openai import OpenAI
def create_custom_character(character_description):
client = OpenAI(api_key=api_key)
response = client.images.generate(
model="dall-e-3",
prompt=f"Please create the following 3D character in the style of Pixar Animation Studio with a blurred sunlight background: {character_description}. There should be no text in the image.",
size="1024x1024",
quality="standard",
n=1,
)
return response.data[0].url # image url
# Use the character creation method:
character_description = """
A 29 year young woman with long curly red hair. She is wearing a green hoodie with a dinosaur on the front of it.
"""
print(create_custom_character(character_description))
# => This producesl a URL you can click on to view your generated character
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment