Last active
January 29, 2024 07:27
-
-
Save tiny-rawr/ad523bcf3fbe0e2781c81567eec3daf3 to your computer and use it in GitHub Desktop.
Generate a custom character image with OpenAI's DALLE 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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