hitting openai limits. moving to other models
This commit is contained in:
@@ -15,16 +15,16 @@ client = OpenAI()
|
||||
|
||||
|
||||
def image_style(base_prompt: str, style: Styles) -> str:
|
||||
return f"create {style.name} style of {base_prompt}"
|
||||
return f"create {style.name} style image on a white background: {base_prompt}"
|
||||
|
||||
def icon_gen(prompt: str, quality: Literal["hd", "standard"], output: Path = "./output/"):
|
||||
def icon_gen(prompt: str, quality: Literal["hd", "standard"], model: Literal["dall-e-3", "dall-e-2"], output: Path = "./output/"):
|
||||
# Make sure output directory exists
|
||||
output_path = Path(output) / quality
|
||||
output_path = Path(output) / model / quality
|
||||
output_path.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
# Generate the image using the OpenAI client
|
||||
response = client.images.generate(
|
||||
model="dall-e-3",
|
||||
model=model,
|
||||
prompt=prompt,
|
||||
size="1024x1024",
|
||||
quality=quality,
|
||||
@@ -48,5 +48,6 @@ def icon_gen(prompt: str, quality: Literal["hd", "standard"], output: Path = "./
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
dog_emoji = image_style("dog in a hat on a beach with a drink", style=Styles.cartoon)
|
||||
icon_gen(dog_emoji, output=Path("../output"), quality="hd")
|
||||
base_prompt = "A playful, cartoon-style dog icon featuring a round, fluffy body in a warm golden-brown color. The dog has oversized, expressive black eyes and a happy, open mouth showing its tongue out. Two large floppy ears hang down on either side of its head, each with a slightly darker brown color on the inside. The tail is wagging and curved upwards, represented by a simple, thick shape in the same golden-brown. The background is a light blue with a subtle oval shape to make the dog stand out boldly. This design uses strong shapes and clear contrasts for easy recognition in a small format."
|
||||
dog_emoji = image_style(base_prompt, style=Styles.cartoon)
|
||||
icon_gen(dog_emoji, model="dall-e-3", output=Path("../output/test"), quality="hd")
|
||||
|
||||
Reference in New Issue
Block a user