Last active
April 10, 2025 06:19
-
-
Save karmicdice/8ff921ebb88f9e87b82a519941d5ce81 to your computer and use it in GitHub Desktop.
Prompt generator for DALL-E by ChatGPT
This file contains hidden or 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
import os | |
import openai | |
from dotenv import load_dotenv | |
def generate_logo_description(domain, name, description): | |
load_dotenv() | |
openai.api_key = os.getenv("OPENAI_API_KEY") | |
if not openai.api_key: | |
raise ValueError("Environemnt is not suitable") | |
# Construct the prompt | |
prompt = f"Generate a logo prompt to Image AI, for {domain}. {name} is {description} - horizontal with symbol on the left and wording on the right, minimalistic - rich pastels." | |
try: | |
response = openai.ChatCompletion.create( | |
model="gpt-4", # or "4o" | |
messages=[ | |
{"role": "system", "content": "You are a professional logo designer."}, | |
{"role": "user", "content": prompt} | |
] | |
) | |
# Extract the response text | |
logo_description = response.choices[0].message.content | |
# Save the description to a file | |
filename = f"{domain}_logo_description.txt" | |
with open(filename, "w") as file: | |
file.write(logo_description) | |
print(f"Logo description successfully generated and saved as {filename}") | |
return filename | |
except Exception as e: | |
print(f"Error generating logo description: {e}") | |
return None | |
if __name__ == "__main__": | |
import argparse | |
parser = argparse.ArgumentParser(description="Generate a logo description using ChatGPT") | |
parser.add_argument("--domain", required=True, help="Entre Domain name (used for filename)") | |
parser.add_argument("--name", required=True, help="Enter Company/brand name") | |
parser.add_argument("--description", required=True, help="Enter Company/brand description") | |
args = parser.parse_args() | |
generate_logo_description(args.domain, args.name, args.description) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment