Pratap2002 commited on
Commit
da0be90
·
verified ·
1 Parent(s): 2b3ff28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -9
app.py CHANGED
@@ -16,6 +16,7 @@ from fontTools.ttLib import TTFont
16
  from langchain_groq import ChatGroq
17
  import logging
18
 
 
19
  # Load environment variables
20
  from dotenv import load_dotenv
21
  load_dotenv()
@@ -56,22 +57,24 @@ def generate_advertisement_prompt(description):
56
  Description: "{description}"
57
 
58
  Generate a detailed image prompt for an AI image generation model, incorporating these elements:
 
 
59
 
60
- 1. Subject: Describe the main subject or product in the advertisement, including its key features and visual characteristics.
61
 
62
- 2. Composition: Explain how the subject should be positioned within the frame, any specific angles or perspectives to highlight its best features.
63
 
64
- 3. Background: Detail the setting or environment that complements the subject and reinforces the advertisement's message.
65
 
66
- 4. Text Elements: text elemeny should be adverticement purpose like based on the description generate adverticement text.
67
 
68
- 5. Style: Describe the overall visual style, color scheme, and mood that best represents the brand and appeals to the target audience.
69
 
70
- 6. Additional Elements: List any supporting visual elements, such as logos, icons, or graphics that should be included to enhance the advertisement's impact.
71
 
72
- 7. Target Audience: Briefly mention the intended audience to ensure the image resonates with them.
73
 
74
- 8. Think in the basis of adverticment designer and combined all 7 points and make a final prompt.
75
 
76
  Please provide a cohesive image prompt that incorporates all these elements into a striking, attention-grabbing advertisement poster, based on the given description. The prompt should be detailed enough to generate a compelling and effective advertisement image.
77
  """
@@ -140,6 +143,10 @@ def generate_poster():
140
  "Corporate/Professional", "Retro/Vintage", "Modern/Contemporary", "Illustrative/Artistic"
141
  ])
142
 
 
 
 
 
143
  description = st.text_area("Enter prompt for Advertisement:")
144
  if st.button("Use Advertisement Generator", key="ad_generator_button"):
145
  st.session_state.show_ad_generator = True
@@ -168,7 +175,7 @@ def generate_poster():
168
  num_images = st.number_input("Number of Images", min_value=4, max_value=8, value=4)
169
 
170
  if st.button("Generate Images"):
171
- base_prompt = f"Create a minimalistic and realistic poster image with the following text as the header: '{header}'. Use '{sub_header}' as the sub-header. Use this designe style and go with thi {design_style.lower()} style for the post. Include the following text as the description: {description}. The image should have an aspect ratio of {aspect_ratio} and dimensions of {width}x{height}. Ensure the image is in 4k high resolution. Make the design clean and elegant, focusing on simplicity and realism rather than vibrant colors."
172
 
173
  if post_type == "Other":
174
  full_prompt = f"{base_prompt} The image should be suitable for general use across various platforms."
 
16
  from langchain_groq import ChatGroq
17
  import logging
18
 
19
+
20
  # Load environment variables
21
  from dotenv import load_dotenv
22
  load_dotenv()
 
57
  Description: "{description}"
58
 
59
  Generate a detailed image prompt for an AI image generation model, incorporating these elements:
60
+ 1. Header: Give one header based on the description.
61
+ 2. Sub Header: Give one sub header based on the description.
62
 
63
+ 3. Subject: Describe the main subject or product in the advertisement, including its key features and visual characteristics.
64
 
65
+ 4. Composition: Explain how the subject should be positioned within the frame, any specific angles or perspectives to highlight its best features.
66
 
67
+ 5. Background: Detail the setting or environment that complements the subject and reinforces the advertisement's message.
68
 
69
+ 6. Text Elements: text elemeny should be adverticement purpose like based on the description generate adverticement text.
70
 
71
+ 7. Style: Describe the overall visual style, color scheme, and mood that best represents the brand and appeals to the target audience.
72
 
73
+ 8. Additional Elements: List any supporting visual elements, such as logos, icons, or graphics that should be included to enhance the advertisement's impact.
74
 
75
+ 9. Target Audience: Briefly mention the intended audience to ensure the image resonates with them.
76
 
77
+ 10. Think in the basis of adverticment designer and combined all 9 points and make a final prompt.
78
 
79
  Please provide a cohesive image prompt that incorporates all these elements into a striking, attention-grabbing advertisement poster, based on the given description. The prompt should be detailed enough to generate a compelling and effective advertisement image.
80
  """
 
143
  "Corporate/Professional", "Retro/Vintage", "Modern/Contemporary", "Illustrative/Artistic"
144
  ])
145
 
146
+ # Add color selection with predefined options
147
+ color_options = ["None", "Black", "White", "Red", "Blue", "Green", "Yellow", "Purple"]
148
+ selected_color = st.selectbox("Choose a dominant color for the image", color_options)
149
+
150
  description = st.text_area("Enter prompt for Advertisement:")
151
  if st.button("Use Advertisement Generator", key="ad_generator_button"):
152
  st.session_state.show_ad_generator = True
 
175
  num_images = st.number_input("Number of Images", min_value=4, max_value=8, value=4)
176
 
177
  if st.button("Generate Images"):
178
+ base_prompt = f"Create a minimalistic and realistic poster image with the following text as the header: '{header}'. Use '{sub_header}' as the sub-header. Use this design style and go with this {design_style.lower()} style for the post. Include the following text as the description for the advertisement: {description}. The image should have an aspect ratio of {aspect_ratio} and dimensions of {width}x{height}. Use {selected_color.lower()} as the dominant color in the image. Ensure the image is in 4k high resolution. And do not include any extra text in the image only instruction text included.And try to fill the vacant part with releveng images. Make the design clean and elegant, focusing on simplicity and realism."
179
 
180
  if post_type == "Other":
181
  full_prompt = f"{base_prompt} The image should be suitable for general use across various platforms."