Skip to content

Commit

Permalink
bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
vinicvaz committed Nov 27, 2023
1 parent 74ded37 commit 305593e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ REPOSITORY_NAME = "openai_domino_pieces"
REPOSITORY_LABEL = "OpenAI Domino Pieces"

# The version of this Pieces release
# Attention: changing this will create a new release
VERSION = "0.6.1"
# Attention: changing this will create a new release
VERSION = "0.7.0"
16 changes: 8 additions & 8 deletions pieces/PromptCreatorForImageGeneratorPiece/piece.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ def openai_response(self, input_data: InputModel, prompt: str, client: OpenAI):
def piece_function(self, input_data: InputModel, secrets_data: SecretsModel):
if secrets_data.OPENAI_API_KEY is None:
raise Exception("OPENAI_API_KEY not found in ENV vars. Please add it to the secrets section of the Piece.")

client = OpenAI(api_key=secrets_data.OPENAI_API_KEY)

template = """You have access to an AI that generates images through text prompts.
template = """You have access to an AI that generates images through text prompts.
Your function is to write a prompt for this AI from a given context. It is very importat that the maximum size of the output prompt must be 1000 characters.
Keep in mind that the AI generating images has no knowledge of the context you've been given. Therefore, it's crucial to include all the important information in the prompt you generate.
You always write a short prompt that is designed to help the image generator AI create an image for the given context.
You are very good at writing these text prompts for any context that is given to you.
You're very creative in how you describe the context you've been given, and like to vary the mood that runs through the prompt you've written.
You always write a short prompt that is designed to help the image generator AI create an image for the given context.
You are very good at writing these text prompts for any context that is given to you.
You're very creative in how you describe the context you've been given, and like to vary the mood that runs through the prompt you've written.
You always suggest some specific art style for the AI to create the image.
For this one the art style would be: {art_style}
Now, create a prompt to help the image generator AI to create an image for this context:
Expand All @@ -50,7 +50,7 @@ def piece_function(self, input_data: InputModel, secrets_data: SecretsModel):
return OutputModel(
generated_prompt_string=generated_prompt,
)

output_file_path = f"{self.results_path}/generated_prompt.txt"
with open(output_file_path, "w") as f:
f.write(generated_prompt)
Expand All @@ -61,14 +61,14 @@ def piece_function(self, input_data: InputModel, secrets_data: SecretsModel):
return OutputModel(
generated_prompt_file_path=output_file_path
)

self.logger.info(f"Returning prompt as a string and file in: {output_file_path}")
self.format_display_result(input_data, generated_prompt)
return OutputModel(
generated_prompt_string=generated_prompt,
generated_prompt_file_path=output_file_path
)

def format_display_result(self, input_data: InputModel, generated_prompt_string: str):
md_text = f"""
## Generated prompt:
Expand Down

0 comments on commit 305593e

Please sign in to comment.