Update app.py
Browse files
app.py
CHANGED
@@ -85,8 +85,8 @@ def add_text_to_image(image, product_name, tagline, cta_text, font_size=50):
|
|
85 |
|
86 |
return image
|
87 |
|
88 |
-
#
|
89 |
-
def generate_ad(brand_title, tagline, cta, brand_logo, product_image, custom_prompt):
|
90 |
"""
|
91 |
Generate an advertisement image with the provided details.
|
92 |
|
@@ -94,9 +94,9 @@ def generate_ad(brand_title, tagline, cta, brand_logo, product_image, custom_pro
|
|
94 |
brand_title (str): Brand title for the advertisement.
|
95 |
tagline (str): Tagline for the advertisement.
|
96 |
cta (str): Call to action text.
|
97 |
-
brand_logo (file): Brand logo image (optional).
|
98 |
-
product_image (file): Product image (optional).
|
99 |
-
custom_prompt (str): Custom prompt for image generation.
|
100 |
|
101 |
Returns:
|
102 |
PIL Image: Final advertisement image.
|
@@ -124,7 +124,7 @@ def generate_ad(brand_title, tagline, cta, brand_logo, product_image, custom_pro
|
|
124 |
|
125 |
return final_image
|
126 |
|
127 |
-
#
|
128 |
iface = gr.Interface(
|
129 |
fn=generate_ad,
|
130 |
inputs=[
|
@@ -138,5 +138,5 @@ iface = gr.Interface(
|
|
138 |
outputs=gr.Image(label="Generated Advertisement"),
|
139 |
)
|
140 |
|
141 |
-
# Launch Gradio Interface
|
142 |
iface.launch()
|
|
|
85 |
|
86 |
return image
|
87 |
|
88 |
+
# Main function to generate advertisement
|
89 |
+
def generate_ad(brand_title, tagline, cta, brand_logo=None, product_image=None, custom_prompt=None):
|
90 |
"""
|
91 |
Generate an advertisement image with the provided details.
|
92 |
|
|
|
94 |
brand_title (str): Brand title for the advertisement.
|
95 |
tagline (str): Tagline for the advertisement.
|
96 |
cta (str): Call to action text.
|
97 |
+
brand_logo (file, optional): Brand logo image (optional).
|
98 |
+
product_image (file, optional): Product image (optional).
|
99 |
+
custom_prompt (str, optional): Custom prompt for image generation.
|
100 |
|
101 |
Returns:
|
102 |
PIL Image: Final advertisement image.
|
|
|
124 |
|
125 |
return final_image
|
126 |
|
127 |
+
# Gradio Interface
|
128 |
iface = gr.Interface(
|
129 |
fn=generate_ad,
|
130 |
inputs=[
|
|
|
138 |
outputs=gr.Image(label="Generated Advertisement"),
|
139 |
)
|
140 |
|
141 |
+
# Launch the Gradio Interface
|
142 |
iface.launch()
|