Skip to content

Commit

Permalink
bad dreams
Browse files Browse the repository at this point in the history
  • Loading branch information
aayars committed Aug 7, 2023
1 parent 70ce1d3 commit 961f4b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 7 additions & 2 deletions noisemaker/ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def describe(preset_name, prompt, filename):
return summary


def dream():
def dream(nightmare=False):
api_key = None
api_key_path = util.get_noisemaker_dir() + "/.creds/.openai"
if os.path.exists(api_key_path):
Expand All @@ -182,7 +182,12 @@ def dream():
if api_key is None:
raise Exception(f"Missing OpenAI API key at {api_key_path}.")

system_prompt = "Imagine a system that generates images from a text prompt, and come up with a prompt from the deepest reaches of your synthetic imagination, as if it were something from a vision or dream. The image must not include humanoid forms. Do not label the answers with anything like \"Name\" or \"Description\". The description may not exceed 250 characters."
if nightmare:
flavor_text = "a dark and powerful omen portending a prophetic event, perhaps apocalyptic in nature. To know the thing is to know madness."
else:
flavor_text = "as if it were something from a vision or dream."

system_prompt = f"Imagine a system that generates images from a text prompt, and come up with a prompt from the deepest reaches of your synthetic imagination, {flavor_text} The image must not include humanoid forms. Do not label the answers with anything like \"Name\" or \"Description\". The description may not exceed 250 characters."

user_prompt = "What is the name and description of the composition? Provide the name and description in semicolon-delimited format."

Expand Down
5 changes: 3 additions & 2 deletions noisemaker/scripts/noisemaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,13 @@ def _use_reasonable_speed(preset, frame_count):
@cli.width_option()
@cli.height_option()
@cli.seed_option()
@click.option('--nightmare', help="This isn't fun anymore", is_flag=True, default=False)
@cli.filename_option(default='dream.png')
def dream(width, height, seed, filename):
def dream(width, height, seed, nightmare, filename):
if seed is None:
seed = random.randint(1, MAX_SEED_VALUE)

name, prompt = ai.dream()
name, prompt = ai.dream(nightmare)

shape = [height, width, 3]

Expand Down

0 comments on commit 961f4b4

Please sign in to comment.