File size: 1,628 Bytes
409166a
24715fe
409166a
 
 
 
 
 
 
 
 
 
 
24715fe
 
 
 
 
 
 
 
 
409166a
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import gradio as gr
from agent import ad_copy_agent, generate_ad_image, sentiment_agent, timing_agent

# Gradio UI definition
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]  # Return first image URL

        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()