|
import gradio as gr |
|
from agent import ad_copy_agent, generate_ad_image, sentiment_agent, timing_agent |
|
|
|
|
|
with gr.Blocks() as demo: |
|
gr.Markdown("# π Marketing AI Dashboard") |
|
|
|
with gr.Tab("Ad Copy Generator"): |
|
prod = gr.Textbox(label="Product") |
|
desc = gr.Textbox(label="Description") |
|
audience = gr.Textbox(label="Audience") |
|
tone = gr.Textbox(label="Tone") |
|
ad_output = gr.Textbox(label="Generated Ads") |
|
image_output = gr.Image(label="Generated Ad Image") |
|
ad_button = gr.Button("Generate Ads + Image") |
|
|
|
def generate_ad_and_image(product, description, audience, tone): |
|
ad_copy, image_prompt = ad_copy_agent(product, description, audience, tone) |
|
image_urls = generate_ad_image(image_prompt) |
|
return ad_copy, image_urls[0] |
|
|
|
ad_button.click(generate_ad_and_image, [prod, desc, audience, tone], [ad_output, image_output]) |
|
|
|
with gr.Tab("Sentiment Analyzer"): |
|
social_input = gr.Textbox(label="Social Media Mentions / Input") |
|
sentiment_output = gr.Textbox(label="Sentiment Analysis") |
|
sentiment_button = gr.Button("Analyze Sentiment") |
|
sentiment_button.click(sentiment_agent, social_input, sentiment_output) |
|
|
|
with gr.Tab("Post Timing Recommender"): |
|
platform_input = gr.Textbox(label="Platform (e.g., Facebook, Instagram)") |
|
timing_output = gr.Textbox(label="Recommended Times") |
|
timing_button = gr.Button("Get Recommendations") |
|
timing_button.click(timing_agent, platform_input, timing_output) |
|
|
|
demo.launch() |