Spaces:
Running
Running
Update generator_function/image_function.py
Browse files
generator_function/image_function.py
CHANGED
|
@@ -335,7 +335,7 @@ def generate_image(file_path, size, quality, category, sentiment, user_prompt, p
|
|
| 335 |
logger.critical("OPENAI_API_KEY is not set.")
|
| 336 |
raise RuntimeError("OPENAI_API_KEY is missing")
|
| 337 |
client = OpenAI(api_key=api_key)
|
| 338 |
-
|
| 339 |
|
| 340 |
with open(file_path, "rb") as img_file:
|
| 341 |
background = "blurred background." if blur else " not blurred background."
|
|
@@ -346,7 +346,7 @@ def generate_image(file_path, size, quality, category, sentiment, user_prompt, p
|
|
| 346 |
f"Your objective is to analyze the provided winning ad image, deconstruct its concept, visual composition, and color scheme, and generate a fresh, conversion-focused ad visual tailored for the {category} niche.\n"
|
| 347 |
f"The new design should convey a {sentiment} sentiment and incorporate the user instruction: \n {user_prompt}.\n If user has given multple choices or options to be include in the image so choose randomly relevant to the reference image."
|
| 348 |
f"Create a visually compelling ad optimized for {platform} Ads that is scroll-stopping, pattern-interrupting, and designed to drive high CTR and Conversion Rate. Utilize striking color combinations, dynamic contrast levels, and strategic layout compositions to command attention while aligning with the target audience avatar.\n"
|
| 349 |
-
f"Make sure the images should be realistic, not be stocky at all and raw which should look like they are shot from an iPhone with {background}.
|
| 350 |
),
|
| 351 |
image=img_file,
|
| 352 |
size=size,
|
|
|
|
| 335 |
logger.critical("OPENAI_API_KEY is not set.")
|
| 336 |
raise RuntimeError("OPENAI_API_KEY is missing")
|
| 337 |
client = OpenAI(api_key=api_key)
|
| 338 |
+
|
| 339 |
|
| 340 |
with open(file_path, "rb") as img_file:
|
| 341 |
background = "blurred background." if blur else " not blurred background."
|
|
|
|
| 346 |
f"Your objective is to analyze the provided winning ad image, deconstruct its concept, visual composition, and color scheme, and generate a fresh, conversion-focused ad visual tailored for the {category} niche.\n"
|
| 347 |
f"The new design should convey a {sentiment} sentiment and incorporate the user instruction: \n {user_prompt}.\n If user has given multple choices or options to be include in the image so choose randomly relevant to the reference image."
|
| 348 |
f"Create a visually compelling ad optimized for {platform} Ads that is scroll-stopping, pattern-interrupting, and designed to drive high CTR and Conversion Rate. Utilize striking color combinations, dynamic contrast levels, and strategic layout compositions to command attention while aligning with the target audience avatar.\n"
|
| 349 |
+
f"Make sure the images should be realistic, not be stocky at all and raw which should look like they are shot from an iPhone with {background}."
|
| 350 |
),
|
| 351 |
image=img_file,
|
| 352 |
size=size,
|