New tools added to ToBeMigrated/ directory: ai_marketing_tools/: - ai_backlinker: AI-powered backlink generation - ai_google_ads_generator: Google Ads generation with templates ai_writers/: - ai_blog_faqs_writer: FAQ generation for blogs - ai_copywriter: Multiple copywriter frameworks (AIDA, PAS, 4C, 4R, etc.) - ai_finance_report_generator: Financial report generation - ai_story_illustrator: Story illustration - ai_story_video_generator: Story video generation - ai_story_writer: AI story writing - github_blogs: GitHub blog integration - speech_to_blog: Audio to blog conversion - twitter_writers: Twitter/X content generation - youtube_writers: YouTube content generation These tools are in ToBeMigrated/ for future migration to the main backend.
This commit is contained in:
226
ToBeMigrated/ai_writers/ai_copywriter/4c_copywriter.py
Normal file
226
ToBeMigrated/ai_writers/ai_copywriter/4c_copywriter.py
Normal file
@@ -0,0 +1,226 @@
|
||||
import streamlit as st
|
||||
from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen
|
||||
from tenacity import retry, wait_random_exponential, stop_after_attempt
|
||||
|
||||
def input_section():
|
||||
st.markdown("""
|
||||
<div style='background-color: #f0f2f6; padding: 20px; border-radius: 10px; margin-bottom: 20px;'>
|
||||
<h2 style='color: #1E88E5;'>🎯 4C Copywriting Generator</h2>
|
||||
<p>Create compelling copy that follows the 4C (Clear, Concise, Credible, Compelling) framework to drive conversions.</p>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Educational content about 4C copywriting
|
||||
with st.expander("📚 What is 4C Copywriting?", expanded=False):
|
||||
st.markdown("""
|
||||
### Understanding the 4C Copywriting Framework
|
||||
|
||||
The 4C framework is a powerful copywriting approach that ensures your message is effective and persuasive:
|
||||
|
||||
- **Clear**: Your message is easy to understand, with no ambiguity or confusion
|
||||
- **Concise**: Your copy is brief and to the point, without unnecessary words
|
||||
- **Credible**: Your claims are backed by evidence, testimonials, or authority
|
||||
- **Compelling**: Your message is interesting and persuasive, motivating action
|
||||
|
||||
### Why 4C Copywriting Works
|
||||
|
||||
The 4C framework works because it:
|
||||
|
||||
- Improves readability and comprehension
|
||||
- Respects the reader's time and attention
|
||||
- Builds trust and credibility
|
||||
- Increases the likelihood of conversion
|
||||
- Creates a professional, polished impression
|
||||
- Works across all marketing channels and platforms
|
||||
|
||||
### When to Use 4C Copywriting
|
||||
|
||||
The 4C framework is particularly effective for:
|
||||
|
||||
- Email marketing campaigns
|
||||
- Landing pages and sales pages
|
||||
- Social media posts and ads
|
||||
- Product descriptions
|
||||
- Service offerings
|
||||
- Any marketing content where clarity and persuasion are essential
|
||||
""")
|
||||
|
||||
# Main input form
|
||||
with st.expander("✍️ Create Your 4C Copy", expanded=True):
|
||||
col1, col2 = st.columns([1, 1])
|
||||
|
||||
with col1:
|
||||
brand_name = st.text_input('**🏢 Brand/Company Name**',
|
||||
placeholder="e.g., Alwrity AI Writer",
|
||||
help="Enter the name of your brand or company.")
|
||||
|
||||
target_audience = st.text_input('**👥 Target Audience**',
|
||||
placeholder="e.g., Small business owners, Content marketers",
|
||||
help="Who is your ideal customer? Be specific about demographics and psychographics.")
|
||||
|
||||
campaign_description = st.text_input('**📝 Campaign Description** (In 3-4 words)',
|
||||
placeholder="e.g., AI writing assistant",
|
||||
help="Describe your campaign briefly.")
|
||||
|
||||
clear_message = st.text_area('**🔍 Clear Message**',
|
||||
placeholder="e.g., Our AI writing assistant helps you create high-quality content in minutes",
|
||||
help="What is the main message you want to convey? Make it easy to understand.")
|
||||
|
||||
with col2:
|
||||
brand_description = st.text_input('**📋 Brand Description** (In 2-3 words)',
|
||||
placeholder="e.g., AI writing platform",
|
||||
help="Describe what your company does briefly.")
|
||||
|
||||
unique_selling_point = st.text_input('**💎 Unique Selling Point**',
|
||||
placeholder="e.g., All-in-one AI copywriting platform",
|
||||
help="What makes your product/service different from competitors?")
|
||||
|
||||
concise_content = st.text_area('**📏 Concise Content**',
|
||||
placeholder="e.g., Create content 10x faster with our AI assistant",
|
||||
help="How can you express your message in the fewest words possible?")
|
||||
|
||||
credible_elements = st.text_area('**✅ Credible Elements**',
|
||||
placeholder="e.g., Trusted by 10,000+ businesses, 4.8/5 star rating, 30-day money-back guarantee",
|
||||
help="What evidence, testimonials, or authority can you use to build credibility?")
|
||||
|
||||
compelling_hook = st.text_area('**🎣 Compelling Hook**',
|
||||
placeholder="e.g., Stop struggling with writer's block. Our AI assistant helps you create engaging content in minutes.",
|
||||
help="What will grab attention and motivate action?")
|
||||
|
||||
call_to_action = st.text_area('**🚀 Call to Action**',
|
||||
placeholder="e.g., Start creating high-converting content today with our 14-day free trial...",
|
||||
help="Prompt your audience to take action with a strong call to action.")
|
||||
|
||||
landing_page_url = st.text_input('**🌐 Landing Page URL** (Optional)',
|
||||
placeholder="e.g., https://alwrity.com",
|
||||
help="Provide a URL to include in your call to action.")
|
||||
|
||||
col1, col2 = st.columns([1, 1])
|
||||
with col1:
|
||||
platform = st.selectbox(
|
||||
'**📱 Content Platform**',
|
||||
options=['Social media copy', 'Email copy', 'Website copy', 'Ad copy', 'Product copy'],
|
||||
help="Select the platform where your copy will be used."
|
||||
)
|
||||
|
||||
with col2:
|
||||
language = st.selectbox(
|
||||
'**🌍 Language**',
|
||||
options=['English', 'Hindustani', 'Chinese', 'Hindi', 'Spanish'],
|
||||
help="Select the language for your copy."
|
||||
)
|
||||
|
||||
tone_style = st.selectbox(
|
||||
'**🎭 Copy Tone & Style**',
|
||||
options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'],
|
||||
help="Select the tone and style for your copy."
|
||||
)
|
||||
|
||||
if st.button('**🚀 Generate 4C Copy**', type="primary"):
|
||||
if not brand_name or not brand_description or not campaign_description or not clear_message or not concise_content or not credible_elements or not compelling_hook:
|
||||
st.error("⚠️ Please fill in all required fields (Brand Name, Description, Campaign Description, Clear Message, Concise Content, Credible Elements, and Compelling Hook)!")
|
||||
else:
|
||||
with st.spinner("✨ Crafting compelling 4C copy..."):
|
||||
four_cs_copy = generate_four_cs_copy(
|
||||
brand_name,
|
||||
brand_description,
|
||||
campaign_description,
|
||||
clear_message,
|
||||
concise_content,
|
||||
credible_elements,
|
||||
compelling_hook,
|
||||
target_audience,
|
||||
unique_selling_point,
|
||||
call_to_action,
|
||||
landing_page_url,
|
||||
platform,
|
||||
language,
|
||||
tone_style
|
||||
)
|
||||
|
||||
if four_cs_copy:
|
||||
st.markdown("""
|
||||
<div style='background-color: #e6f7ff; padding: 20px; border-radius: 10px; margin-top: 20px;'>
|
||||
<h3 style='color: #0066cc;'>🎯 Your 4C Copy</h3>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Display the copy with a nice format
|
||||
st.markdown(four_cs_copy)
|
||||
|
||||
# Add copy button
|
||||
st.markdown("""
|
||||
<div style='margin-top: 20px;'>
|
||||
<button style='background-color: #4CAF50; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer;'>
|
||||
Copy to Clipboard
|
||||
</button>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Add tips for using the copy
|
||||
with st.expander("💡 Tips for Using Your 4C Copy", expanded=False):
|
||||
st.markdown("""
|
||||
### How to Use Your 4C Copy Effectively
|
||||
|
||||
1. **Test for clarity**: Ask someone unfamiliar with your product to read your copy and explain what they understand
|
||||
|
||||
2. **Edit ruthlessly**: Review your copy to eliminate unnecessary words and phrases
|
||||
|
||||
3. **Add specific details**: Include concrete numbers, statistics, and examples to enhance credibility
|
||||
|
||||
4. **Create urgency**: Add time-sensitive elements to make your compelling hook even more effective
|
||||
|
||||
5. **Consider the context**: Adapt the copy based on where it will appear (landing page, email, social media, etc.)
|
||||
|
||||
6. **Measure results**: Track conversion metrics to see how your 4C copy performs
|
||||
|
||||
7. **Refine over time**: Continuously improve your copy based on audience feedback and performance data
|
||||
""")
|
||||
else:
|
||||
st.error("💥 **Failed to generate 4C Copy. Please try again!**")
|
||||
|
||||
|
||||
@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))
|
||||
def generate_four_cs_copy(brand_name, brand_description, campaign_description, clear_message,
|
||||
concise_content, credible_elements, compelling_hook, target_audience,
|
||||
unique_selling_point, call_to_action, landing_page_url, platform,
|
||||
language, tone_style):
|
||||
system_prompt = """You are an expert copywriter specializing in the 4C (Clear, Concise, Credible, Compelling) framework.
|
||||
Your expertise is in creating effective, persuasive marketing copy that communicates clearly, builds credibility, and drives action.
|
||||
Your copy is authentic, specific to the brand, and focused on driving measurable results."""
|
||||
|
||||
prompt = f"""Create 3 different marketing campaigns for {brand_name}, which is a {brand_description}.
|
||||
|
||||
TARGET AUDIENCE: {target_audience}
|
||||
UNIQUE SELLING POINT: {unique_selling_point}
|
||||
PLATFORM: {platform}
|
||||
LANGUAGE: {language}
|
||||
TONE & STYLE: {tone_style}
|
||||
|
||||
Use the 4C framework with these elements:
|
||||
- **Clear Message**: {clear_message}
|
||||
- **Concise Content**: {concise_content}
|
||||
- **Credible Elements**: {credible_elements}
|
||||
- **Compelling Hook**: {compelling_hook}
|
||||
- **Call to Action**: {call_to_action}
|
||||
"""
|
||||
|
||||
if landing_page_url:
|
||||
prompt += f"\nInclude the landing page URL ({landing_page_url}) in your call to action."
|
||||
|
||||
prompt += """
|
||||
For each campaign:
|
||||
1. Start with a compelling hook that grabs attention
|
||||
2. Present your clear message in a concise way
|
||||
3. Support your claims with credible elements
|
||||
4. End with a strong call to action
|
||||
|
||||
Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers.
|
||||
Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires.
|
||||
"""
|
||||
|
||||
try:
|
||||
return llm_text_gen(prompt, system_prompt=system_prompt)
|
||||
except Exception as e:
|
||||
st.error(f"Error generating copy: {str(e)}")
|
||||
return None
|
||||
214
ToBeMigrated/ai_writers/ai_copywriter/4r_copywriter.py
Normal file
214
ToBeMigrated/ai_writers/ai_copywriter/4r_copywriter.py
Normal file
@@ -0,0 +1,214 @@
|
||||
import streamlit as st
|
||||
from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen
|
||||
from tenacity import retry, wait_random_exponential, stop_after_attempt
|
||||
|
||||
def input_section():
|
||||
st.markdown("""
|
||||
<div style='background-color: #f0f2f6; padding: 20px; border-radius: 10px; margin-bottom: 20px;'>
|
||||
<h2 style='color: #1E88E5;'>🎯 4R Copywriting Generator</h2>
|
||||
<p>Create compelling copy that follows the 4R (Relevance, Resonance, Response, Results) framework to drive conversions.</p>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Educational content about 4R copywriting
|
||||
with st.expander("📚 What is 4R Copywriting?", expanded=False):
|
||||
st.markdown("""
|
||||
### Understanding the 4R Copywriting Framework
|
||||
|
||||
The 4R framework is a powerful copywriting approach that ensures your message connects with your audience and drives action:
|
||||
|
||||
- **Relevance**: Your message addresses the specific needs, interests, or pain points of your target audience
|
||||
- **Resonance**: Your copy creates an emotional connection with the audience, making them feel understood
|
||||
- **Response**: Your message prompts the audience to take a specific action
|
||||
- **Results**: Your copy clearly communicates the positive outcomes or benefits the audience will experience
|
||||
|
||||
### Why 4R Copywriting Works
|
||||
|
||||
The 4R framework works because it:
|
||||
|
||||
- Ensures your message is targeted to the right audience
|
||||
- Creates emotional connections that build trust and loyalty
|
||||
- Drives specific actions that lead to conversions
|
||||
- Focuses on the outcomes that matter most to your audience
|
||||
- Creates a complete journey from awareness to action
|
||||
- Works across all marketing channels and platforms
|
||||
|
||||
### When to Use 4R Copywriting
|
||||
|
||||
The 4R framework is particularly effective for:
|
||||
|
||||
- Email marketing campaigns
|
||||
- Landing pages and sales pages
|
||||
- Social media posts and ads
|
||||
- Product descriptions
|
||||
- Service offerings
|
||||
- Any marketing content where audience connection and action are essential
|
||||
""")
|
||||
|
||||
# Main input form
|
||||
with st.expander("✍️ Create Your 4R Copy", expanded=True):
|
||||
col1, col2 = st.columns([1, 1])
|
||||
|
||||
with col1:
|
||||
brand_name = st.text_input('**🏢 Brand/Company Name**',
|
||||
placeholder="e.g., Alwrity AI Writer",
|
||||
help="Enter the name of your brand or company.")
|
||||
|
||||
target_audience = st.text_input('**👥 Target Audience**',
|
||||
placeholder="e.g., Small business owners, Content marketers",
|
||||
help="Who is your ideal customer? Be specific about demographics and psychographics.")
|
||||
|
||||
relevance = st.text_area('**🎯 Relevance**',
|
||||
placeholder="e.g., Struggling with writer's block? Our AI assistant helps you create high-quality content in minutes",
|
||||
help="How does your product/service address the specific needs or pain points of your target audience?")
|
||||
|
||||
with col2:
|
||||
brand_description = st.text_input('**📋 Brand Description** (In 2-3 words)',
|
||||
placeholder="e.g., AI writing platform",
|
||||
help="Describe what your company does briefly.")
|
||||
|
||||
unique_selling_point = st.text_input('**💎 Unique Selling Point**',
|
||||
placeholder="e.g., All-in-one AI copywriting platform",
|
||||
help="What makes your product/service different from competitors?")
|
||||
|
||||
resonance = st.text_area('**💖 Resonance**',
|
||||
placeholder="e.g., We understand the frustration of staring at a blank page. Our AI assistant feels like having a professional writer by your side",
|
||||
help="How can you create an emotional connection with your audience? What language or imagery will resonate with them?")
|
||||
|
||||
response = st.text_area('**🚀 Response**',
|
||||
placeholder="e.g., Start creating high-converting content today with our 14-day free trial",
|
||||
help="What specific action do you want your audience to take?")
|
||||
|
||||
results = st.text_area('**✨ Results**',
|
||||
placeholder="e.g., Save 20+ hours per week on content creation, increase conversion rates by 35%, improve SEO rankings",
|
||||
help="What positive outcomes or benefits will your audience experience?")
|
||||
|
||||
landing_page_url = st.text_input('**🌐 Landing Page URL** (Optional)',
|
||||
placeholder="e.g., https://alwrity.com",
|
||||
help="Provide a URL to include in your call to action.")
|
||||
|
||||
col1, col2 = st.columns([1, 1])
|
||||
with col1:
|
||||
platform = st.selectbox(
|
||||
'**📱 Content Platform**',
|
||||
options=['Social media copy', 'Email copy', 'Website copy', 'Ad copy', 'Product copy'],
|
||||
help="Select the platform where your copy will be used."
|
||||
)
|
||||
|
||||
with col2:
|
||||
language = st.selectbox(
|
||||
'**🌍 Language**',
|
||||
options=['English', 'Hindustani', 'Chinese', 'Hindi', 'Spanish'],
|
||||
help="Select the language for your copy."
|
||||
)
|
||||
|
||||
tone_style = st.selectbox(
|
||||
'**🎭 Copy Tone & Style**',
|
||||
options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'],
|
||||
help="Select the tone and style for your copy."
|
||||
)
|
||||
|
||||
if st.button('**🚀 Generate 4R Copy**', type="primary"):
|
||||
if not brand_name or not brand_description or not relevance or not resonance or not response or not results:
|
||||
st.error("⚠️ Please fill in all required fields (Brand Name, Description, Relevance, Resonance, Response, and Results)!")
|
||||
else:
|
||||
with st.spinner("✨ Crafting compelling 4R copy..."):
|
||||
four_r_copy = generate_four_r_copy(
|
||||
brand_name,
|
||||
brand_description,
|
||||
relevance,
|
||||
resonance,
|
||||
response,
|
||||
results,
|
||||
target_audience,
|
||||
unique_selling_point,
|
||||
landing_page_url,
|
||||
platform,
|
||||
language,
|
||||
tone_style
|
||||
)
|
||||
|
||||
if four_r_copy:
|
||||
st.markdown("""
|
||||
<div style='background-color: #e6f7ff; padding: 20px; border-radius: 10px; margin-top: 20px;'>
|
||||
<h3 style='color: #0066cc;'>🎯 Your 4R Copy</h3>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Display the copy with a nice format
|
||||
st.markdown(four_r_copy)
|
||||
|
||||
# Add copy button
|
||||
st.markdown("""
|
||||
<div style='margin-top: 20px;'>
|
||||
<button style='background-color: #4CAF50; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer;'>
|
||||
Copy to Clipboard
|
||||
</button>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Add tips for using the copy
|
||||
with st.expander("💡 Tips for Using Your 4R Copy", expanded=False):
|
||||
st.markdown("""
|
||||
### How to Use Your 4R Copy Effectively
|
||||
|
||||
1. **Test for relevance**: Ensure your copy speaks directly to your target audience's needs and interests
|
||||
|
||||
2. **Enhance emotional resonance**: Use language and imagery that creates a deeper connection with your audience
|
||||
|
||||
3. **Clarify the response**: Make sure your call to action is clear, specific, and compelling
|
||||
|
||||
4. **Quantify results**: Use specific numbers, statistics, and examples to make your results more tangible
|
||||
|
||||
5. **Consider the context**: Adapt the copy based on where it will appear (landing page, email, social media, etc.)
|
||||
|
||||
6. **Measure performance**: Track conversion metrics to see how your 4R copy performs
|
||||
|
||||
7. **Refine over time**: Continuously improve your copy based on audience feedback and performance data
|
||||
""")
|
||||
else:
|
||||
st.error("💥 **Failed to generate 4R Copy. Please try again!**")
|
||||
|
||||
|
||||
@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))
|
||||
def generate_four_r_copy(brand_name, brand_description, relevance, resonance, response, results,
|
||||
target_audience, unique_selling_point, landing_page_url, platform,
|
||||
language, tone_style):
|
||||
system_prompt = """You are an expert copywriter specializing in the 4R (Relevance, Resonance, Response, Results) framework.
|
||||
Your expertise is in creating compelling marketing copy that connects with audiences on a deep level and drives specific actions.
|
||||
Your copy is authentic, specific to the brand, and focused on driving measurable results."""
|
||||
|
||||
prompt = f"""Create 3 different marketing campaigns for {brand_name}, which is a {brand_description}.
|
||||
|
||||
TARGET AUDIENCE: {target_audience}
|
||||
UNIQUE SELLING POINT: {unique_selling_point}
|
||||
PLATFORM: {platform}
|
||||
LANGUAGE: {language}
|
||||
TONE & STYLE: {tone_style}
|
||||
|
||||
Use the 4R framework with these elements:
|
||||
- **Relevance**: {relevance}
|
||||
- **Resonance**: {resonance}
|
||||
- **Response**: {response}
|
||||
- **Results**: {results}
|
||||
"""
|
||||
|
||||
if landing_page_url:
|
||||
prompt += f"\nInclude the landing page URL ({landing_page_url}) in your call to action."
|
||||
|
||||
prompt += """
|
||||
For each campaign:
|
||||
1. Start by establishing relevance to your target audience's needs or pain points
|
||||
2. Create emotional resonance by connecting with your audience's feelings and experiences
|
||||
3. Clearly communicate the specific action you want your audience to take
|
||||
4. End by highlighting the positive results or benefits they will experience
|
||||
|
||||
Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers.
|
||||
Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires.
|
||||
"""
|
||||
|
||||
try:
|
||||
return llm_text_gen(prompt, system_prompt=system_prompt)
|
||||
except Exception as e:
|
||||
st.error(f"Error generating copy: {str(e)}")
|
||||
return None
|
||||
141
ToBeMigrated/ai_writers/ai_copywriter/README.md
Normal file
141
ToBeMigrated/ai_writers/ai_copywriter/README.md
Normal file
@@ -0,0 +1,141 @@
|
||||
# AI Copywriting Tools
|
||||
|
||||
A comprehensive collection of AI-powered copywriting tools designed to help create compelling, conversion-focused content using various proven frameworks and approaches.
|
||||
|
||||
## Available Copywriting Tools
|
||||
|
||||
### 1. AIDA Copywriter
|
||||
The AIDA (Attention-Interest-Desire-Action) framework is a classic copywriting approach that guides your audience through a complete journey:
|
||||
- **Attention**: Captures attention with compelling headlines
|
||||
- **Interest**: Generates interest through benefits and pain points
|
||||
- **Desire**: Creates desire by showcasing solutions
|
||||
- **Action**: Prompts specific actions with strong CTAs
|
||||
|
||||
Best for: Landing pages, sales pages, email campaigns, and direct response advertising.
|
||||
|
||||
### 2. 4C Copywriter
|
||||
The 4C framework ensures your message is effective and persuasive through:
|
||||
- **Clear**: Easy to understand messaging
|
||||
- **Concise**: Brief and to-the-point content
|
||||
- **Credible**: Evidence-backed claims
|
||||
- **Compelling**: Interesting and persuasive messaging
|
||||
|
||||
Best for: Email marketing, landing pages, social media, and product descriptions.
|
||||
|
||||
### 3. 4R Copywriter
|
||||
The 4R framework focuses on building relationships with your audience through:
|
||||
- **Relevance**: Content that matters to your audience
|
||||
- **Receptivity**: Timing and context optimization
|
||||
- **Response**: Clear calls to action
|
||||
- **Return**: Value-driven content
|
||||
|
||||
Best for: Content marketing, blog posts, and relationship-building campaigns.
|
||||
|
||||
### 4. PAS Copywriter
|
||||
The PAS (Problem-Agitation-Solution) framework addresses customer pain points:
|
||||
- **Problem**: Identifies the customer's issue
|
||||
- **Agitation**: Amplifies the problem's impact
|
||||
- **Solution**: Presents your offering as the answer
|
||||
|
||||
Best for: Problem-solving content, product launches, and service offerings.
|
||||
|
||||
### 5. FAB Copywriter
|
||||
The FAB (Features-Advantages-Benefits) framework focuses on product value:
|
||||
- **Features**: Product characteristics
|
||||
- **Advantages**: How features stand out
|
||||
- **Benefits**: Customer value proposition
|
||||
|
||||
Best for: Product descriptions, sales pages, and feature highlights.
|
||||
|
||||
### 6. QUEST Copywriter
|
||||
The QUEST framework creates engaging storytelling:
|
||||
- **Qualify**: Identify the right audience
|
||||
- **Understand**: Show empathy
|
||||
- **Educate**: Provide value
|
||||
- **Stimulate**: Create desire
|
||||
- **Transition**: Guide to action
|
||||
|
||||
Best for: Story-based marketing, brand storytelling, and content marketing.
|
||||
|
||||
### 7. STAR Copywriter
|
||||
The STAR framework focuses on social proof and testimonials:
|
||||
- **Situation**: Context of the problem
|
||||
- **Task**: Challenge faced
|
||||
- **Action**: Solution implemented
|
||||
- **Result**: Outcome achieved
|
||||
|
||||
Best for: Case studies, testimonials, and success stories.
|
||||
|
||||
### 8. OATH Copywriter
|
||||
The OATH framework addresses customer objections:
|
||||
- **Objection**: Identify common concerns
|
||||
- **Acknowledge**: Show understanding
|
||||
- **Transform**: Turn negatives to positives
|
||||
- **Handle**: Provide solutions
|
||||
|
||||
Best for: Sales pages, product launches, and objection handling.
|
||||
|
||||
### 9. AIDPPC Copywriter
|
||||
The AIDPPC framework extends AIDA with additional elements:
|
||||
- **Attention**: Initial hook
|
||||
- **Interest**: Generate curiosity
|
||||
- **Desire**: Create want
|
||||
- **Proof**: Provide evidence
|
||||
- **Push**: Create urgency
|
||||
- **Close**: Final call to action
|
||||
|
||||
Best for: Long-form sales pages and comprehensive marketing materials.
|
||||
|
||||
### 10. Emotional Copywriter
|
||||
Focuses on creating emotional connections through:
|
||||
- Emotional triggers (FOMO, trust, joy, urgency)
|
||||
- Personal connections
|
||||
- Pain point addressing
|
||||
- Trust building
|
||||
- Community creation
|
||||
|
||||
Best for: Brand storytelling, emotional marketing, and relationship building.
|
||||
|
||||
## Features
|
||||
|
||||
All copywriting tools include:
|
||||
- User-friendly interface with Streamlit
|
||||
- Educational content about each framework
|
||||
- Customizable input parameters
|
||||
- Multiple language support
|
||||
- Tone and style options
|
||||
- Target audience customization
|
||||
- Brand-specific content generation
|
||||
- Retry mechanism for reliable API calls
|
||||
|
||||
## Usage
|
||||
|
||||
1. Select your desired copywriting framework
|
||||
2. Fill in the required information:
|
||||
- Brand/Company details
|
||||
- Target audience
|
||||
- Unique selling points
|
||||
- Desired tone and style
|
||||
- Platform-specific requirements
|
||||
3. Generate your copy
|
||||
4. Review and refine the output
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. **Know Your Audience**: Always provide detailed target audience information
|
||||
2. **Be Specific**: Include clear unique selling points and value propositions
|
||||
3. **Choose the Right Framework**: Match the framework to your content goals
|
||||
4. **Maintain Consistency**: Keep brand voice and messaging consistent
|
||||
5. **Test and Optimize**: Use different frameworks for A/B testing
|
||||
6. **Review and Edit**: Always review AI-generated content for accuracy and tone
|
||||
|
||||
## Technical Requirements
|
||||
|
||||
- Python 3.7+
|
||||
- Streamlit
|
||||
- GPT API access
|
||||
- Required Python packages (see requirements.txt)
|
||||
|
||||
## Support
|
||||
|
||||
For technical support or questions about specific frameworks, please refer to the documentation or contact the development team.
|
||||
97
ToBeMigrated/ai_writers/ai_copywriter/README_TBD.md
Normal file
97
ToBeMigrated/ai_writers/ai_copywriter/README_TBD.md
Normal file
@@ -0,0 +1,97 @@
|
||||
# Brainstorming for Copywriting Tools UI and Features (TBD)
|
||||
|
||||
## Showing All Copywriting Tools in a Single UI
|
||||
|
||||
1. **Unified Dashboard Approach**
|
||||
- Create a central dashboard with cards/tiles for each copywriting formula
|
||||
- Use visual icons and brief descriptions to distinguish each formula
|
||||
- Implement a consistent color scheme and design language across all tools
|
||||
|
||||
2. **Categorization System**
|
||||
- Group formulas by purpose (e.g., "Emotional Appeal," "Problem-Solution," "Storytelling")
|
||||
- Allow users to filter by category or search by keyword
|
||||
- Include a "Featured" or "Popular" section for commonly used formulas
|
||||
|
||||
3. **Interactive Selection Interface**
|
||||
- Create a decision tree or guided selection process
|
||||
- Ask users a few key questions to recommend the most appropriate formula
|
||||
- Show a comparison view of multiple formulas side-by-side
|
||||
|
||||
4. **Progressive Disclosure**
|
||||
- Start with a simplified view showing just the formula names and basic descriptions
|
||||
- Allow users to expand each formula for more details and to start using it
|
||||
- Implement a "Recently Used" section for quick access to frequently used formulas
|
||||
|
||||
## Presenting the Right Formula for User Needs
|
||||
|
||||
1. **Guided Selection Wizard**
|
||||
- Create a multi-step wizard that asks about the user's marketing goals
|
||||
- Include questions about target audience, industry, content type, and desired outcome
|
||||
- Provide recommendations based on user responses with explanations
|
||||
|
||||
2. **Formula Comparison Tool**
|
||||
- Create a comparison matrix showing strengths of each formula
|
||||
- Include use cases and examples for each formula
|
||||
- Allow users to see side-by-side comparisons of different formulas
|
||||
|
||||
3. **Educational Content Integration**
|
||||
- Add a "Learn More" section for each formula with detailed explanations
|
||||
- Include case studies showing successful applications of each formula
|
||||
- Provide templates and examples for common use cases
|
||||
|
||||
4. **Contextual Recommendations**
|
||||
- Analyze the user's input and automatically suggest the most appropriate formula
|
||||
- Show a confidence score for each recommendation
|
||||
- Allow users to easily switch between formulas if the recommendation isn't right
|
||||
|
||||
## Using AI to Pre-fill Inputs Based on Brief Requirements
|
||||
|
||||
1. **Smart Input Generation**
|
||||
- Create an initial input field where users can describe their copywriting needs in natural language
|
||||
- Use AI to analyze this input and extract key information (brand, audience, goals, etc.)
|
||||
- Pre-fill the formula-specific fields with AI-generated content
|
||||
- Allow users to edit and refine the pre-filled content
|
||||
|
||||
2. **Contextual Understanding**
|
||||
- Implement industry-specific templates and prompts
|
||||
- Use AI to recognize industry terminology and adapt suggestions accordingly
|
||||
- Provide multiple options for each field based on the user's brief description
|
||||
|
||||
3. **Progressive Refinement**
|
||||
- Start with AI-generated suggestions for all fields
|
||||
- Allow users to focus on refining specific fields while keeping others
|
||||
- Implement a "regenerate" option for individual fields if the AI suggestion isn't suitable
|
||||
|
||||
4. **Learning from User Edits**
|
||||
- Track which AI-generated suggestions users keep vs. modify
|
||||
- Use this data to improve future suggestions
|
||||
- Implement a feedback mechanism for users to rate the quality of AI suggestions
|
||||
|
||||
## AI-Generated Images as a Feature
|
||||
|
||||
1. **Complementary Visual Content**
|
||||
- Generate images that match the tone and message of the copy
|
||||
- Create multiple image options for different platforms (social media, email, website)
|
||||
- Ensure images align with the copywriting formula being used
|
||||
|
||||
2. **Integrated Workflow**
|
||||
- Add an "Generate Matching Images" button after copy is created
|
||||
- Allow users to specify image style, mood, and key elements
|
||||
- Provide options to customize generated images further
|
||||
|
||||
3. **Platform-Specific Optimization**
|
||||
- Automatically size and format images for different platforms
|
||||
- Generate variations optimized for different aspect ratios
|
||||
- Include text overlay options that complement the copy
|
||||
|
||||
4. **Brand Consistency**
|
||||
- Allow users to upload brand assets (logos, colors, fonts)
|
||||
- Generate images that maintain brand identity
|
||||
- Create a visual style guide based on user preferences
|
||||
|
||||
5. **Enhanced Engagement**
|
||||
- A/B test different image options with the same copy
|
||||
- Provide analytics on which image-copy combinations perform best
|
||||
- Suggest image improvements based on performance data
|
||||
|
||||
These enhancements would create a more comprehensive, user-friendly copywriting platform that guides users to the right formula, simplifies the input process, and delivers complete marketing assets ready for deployment.
|
||||
182
ToBeMigrated/ai_writers/ai_copywriter/acca_copywriter.py
Normal file
182
ToBeMigrated/ai_writers/ai_copywriter/acca_copywriter.py
Normal file
@@ -0,0 +1,182 @@
|
||||
import streamlit as st
|
||||
from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen
|
||||
|
||||
def input_section():
|
||||
st.markdown("""
|
||||
<div style='background-color: #f0f2f6; padding: 20px; border-radius: 10px; margin-bottom: 20px;'>
|
||||
<h2 style='color: #1E88E5;'>🚀 ACCA Copywriting Generator</h2>
|
||||
<p>Create persuasive marketing copy using the proven ACCA (Awareness-Curiosity-Conviction-Action) formula.</p>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Educational content about ACCA copywriting
|
||||
with st.expander("📚 What is ACCA Copywriting?", expanded=False):
|
||||
st.markdown("""
|
||||
### Understanding the ACCA Copywriting Formula
|
||||
|
||||
The ACCA formula is a powerful copywriting framework that guides your audience through a journey from problem recognition to action:
|
||||
|
||||
- **Awareness**: Highlight the problem or pain point your audience faces
|
||||
- **Curiosity**: Agitate the problem by emphasizing its negative impact
|
||||
- **Conviction**: Present your solution and build confidence in it
|
||||
- **Action**: Provide a clear, compelling call to action
|
||||
|
||||
### Why ACCA Copywriting Works
|
||||
|
||||
The ACCA formula works because it:
|
||||
|
||||
- Follows the natural decision-making process of your audience
|
||||
- Creates a logical progression from problem to solution
|
||||
- Builds emotional investment before asking for commitment
|
||||
- Addresses objections before they arise
|
||||
- Ends with a clear next step
|
||||
|
||||
### When to Use ACCA Copywriting
|
||||
|
||||
The ACCA formula is particularly effective for:
|
||||
|
||||
- Product launches
|
||||
- Service promotions
|
||||
- Problem-solving offers
|
||||
- Educational content
|
||||
- Sales pages
|
||||
- Email marketing sequences
|
||||
""")
|
||||
|
||||
# Main input form
|
||||
with st.expander("✍️ Create Your ACCA Copy", expanded=True):
|
||||
col1, col2 = st.columns([1, 1])
|
||||
|
||||
with col1:
|
||||
brand_name = st.text_input('**🏢 Brand/Company Name**',
|
||||
placeholder="e.g., Alwrity",
|
||||
help="Enter the name of your brand or company.")
|
||||
|
||||
target_audience = st.text_input('**👥 Target Audience**',
|
||||
placeholder="e.g., Small business owners, Tech professionals",
|
||||
help="Who is your ideal customer? Be specific about demographics and psychographics.")
|
||||
|
||||
awareness = st.text_input('❓ **Awareness (Problem)**',
|
||||
placeholder="e.g., Struggling to manage finances",
|
||||
help="What problem or pain point does your audience face?")
|
||||
|
||||
with col2:
|
||||
description = st.text_input('**📝 Brand Description** (In 5-6 words)',
|
||||
placeholder="e.g., AI writing tools",
|
||||
help="Describe your product or service briefly.")
|
||||
|
||||
unique_selling_point = st.text_input('**💎 Unique Selling Point**',
|
||||
placeholder="e.g., 10x faster content creation",
|
||||
help="What makes your product/service different from competitors?")
|
||||
|
||||
curiosity = st.text_input('🔥 **Curiosity (Agitation)**',
|
||||
placeholder="e.g., Leads to financial instability and stress",
|
||||
help="Why is this problem serious for your audience? Highlight the negative impact.")
|
||||
|
||||
conviction = st.text_input('💡 **Conviction (Solution)**',
|
||||
placeholder="e.g., Provides easy-to-use budgeting tools with AI insights",
|
||||
help="How does your product/service solve this problem? Explain the benefits.")
|
||||
|
||||
call_to_action = st.text_input('🎯 **Action (Call to Action)**',
|
||||
placeholder="e.g., Start your free trial today",
|
||||
help="What specific action do you want your audience to take?")
|
||||
|
||||
tone_style = st.selectbox(
|
||||
'**🎭 Copy Tone & Style**',
|
||||
options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'],
|
||||
help="Select the tone and style for your copy."
|
||||
)
|
||||
|
||||
if st.button('**🚀 Generate ACCA Copy**', type="primary"):
|
||||
if not brand_name or not description or not awareness or not curiosity or not conviction:
|
||||
st.error("⚠️ Please fill in all required fields (Brand Name, Description, Awareness, Curiosity, and Conviction)!")
|
||||
else:
|
||||
with st.spinner("✨ Crafting persuasive ACCA copy..."):
|
||||
acca_copy = generate_acca_copy(
|
||||
brand_name,
|
||||
description,
|
||||
awareness,
|
||||
curiosity,
|
||||
conviction,
|
||||
target_audience,
|
||||
unique_selling_point,
|
||||
call_to_action,
|
||||
tone_style
|
||||
)
|
||||
|
||||
if acca_copy:
|
||||
st.markdown("""
|
||||
<div style='background-color: #e6f7ff; padding: 20px; border-radius: 10px; margin-top: 20px;'>
|
||||
<h3 style='color: #0066cc;'>✨ Your ACCA Copy</h3>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Display the copy with a nice format
|
||||
st.markdown(acca_copy)
|
||||
|
||||
# Add copy button
|
||||
st.markdown("""
|
||||
<div style='margin-top: 20px;'>
|
||||
<button style='background-color: #4CAF50; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer;'>
|
||||
Copy to Clipboard
|
||||
</button>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Add tips for using the copy - using a container instead of an expander
|
||||
st.markdown("""
|
||||
<div style='background-color: #f9f9f9; padding: 15px; border-radius: 10px; margin-top: 20px;'>
|
||||
<h3 style='color: #333;'>💡 Tips for Using Your ACCA Copy</h3>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
st.markdown("""
|
||||
### How to Use Your ACCA Copy Effectively
|
||||
|
||||
1. **Test different versions**: A/B test your copy to see which version resonates most with your audience
|
||||
|
||||
2. **Pair with visuals**: Combine your copy with images that reinforce each stage of the ACCA formula
|
||||
|
||||
3. **Consider the platform**: Adapt your copy based on where it will appear (social media, email, website, etc.)
|
||||
|
||||
4. **Measure results**: Track conversion metrics to see how your ACCA copy performs
|
||||
|
||||
5. **Refine over time**: Continuously improve your copy based on audience feedback and performance data
|
||||
""")
|
||||
else:
|
||||
st.error("💥 **Failed to generate ACCA Copy. Please try again!**")
|
||||
|
||||
|
||||
def generate_acca_copy(brand_name, description, awareness, curiosity, conviction, target_audience,
|
||||
unique_selling_point, call_to_action, tone_style):
|
||||
system_prompt = """You are an expert copywriter specializing in the ACCA (Awareness-Curiosity-Conviction-Action) formula.
|
||||
Your expertise is in creating compelling, persuasive marketing copy that guides audiences through a journey from problem
|
||||
recognition to taking action. Your copy is authentic, specific to the brand, and focused on the target audience's needs."""
|
||||
|
||||
prompt = f"""Create 3 different marketing campaigns for {brand_name}, which is a {description}.
|
||||
|
||||
TARGET AUDIENCE: {target_audience}
|
||||
UNIQUE SELLING POINT: {unique_selling_point}
|
||||
TONE & STYLE: {tone_style}
|
||||
|
||||
Use the ACCA formula with these elements:
|
||||
- **Awareness**: {awareness}
|
||||
- **Curiosity**: {curiosity}
|
||||
- **Conviction**: {conviction}
|
||||
- **Action**: {call_to_action}
|
||||
|
||||
For each campaign:
|
||||
1. Create a compelling headline that captures attention
|
||||
2. Write 2-3 paragraphs that follow the ACCA formula
|
||||
3. End with a strong call to action
|
||||
4. Explain how each element of the ACCA formula is used in the copy
|
||||
|
||||
Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers.
|
||||
Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires.
|
||||
"""
|
||||
|
||||
try:
|
||||
return llm_text_gen(prompt, system_prompt=system_prompt)
|
||||
except Exception as e:
|
||||
st.error(f"Error generating copy: {str(e)}")
|
||||
return None
|
||||
168
ToBeMigrated/ai_writers/ai_copywriter/ai_emotional_copywriter.py
Normal file
168
ToBeMigrated/ai_writers/ai_copywriter/ai_emotional_copywriter.py
Normal file
@@ -0,0 +1,168 @@
|
||||
import streamlit as st
|
||||
from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen
|
||||
|
||||
def input_section():
|
||||
st.markdown("""
|
||||
<div style='background-color: #f0f2f6; padding: 20px; border-radius: 10px; margin-bottom: 20px;'>
|
||||
<h2 style='color: #1E88E5;'>🎭 Emotional Copywriting Generator</h2>
|
||||
<p>Create compelling copy that resonates with your audience's emotions and drives action.</p>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Educational content about emotional copywriting
|
||||
with st.expander("📚 What is Emotional Copywriting?", expanded=False):
|
||||
st.markdown("""
|
||||
### Understanding Emotional Copywriting
|
||||
|
||||
Emotional copywriting is a powerful marketing technique that connects with your audience on a deeper level by:
|
||||
|
||||
- **Triggering specific emotions** (joy, fear, urgency, trust, etc.)
|
||||
- **Creating personal connections** with your audience
|
||||
- **Addressing pain points** and offering solutions
|
||||
- **Building trust and credibility**
|
||||
- **Creating a sense of belonging** or exclusivity
|
||||
|
||||
### Why Emotional Copywriting Works
|
||||
|
||||
Research shows that people make purchasing decisions based on emotions first, then justify with logic. By tapping into the right emotions, you can:
|
||||
|
||||
- Increase engagement and response rates
|
||||
- Build stronger brand loyalty
|
||||
- Drive more conversions
|
||||
- Create memorable brand experiences
|
||||
|
||||
### Common Emotional Triggers
|
||||
|
||||
- **Fear of Missing Out (FOMO)**: Limited time offers, exclusive access
|
||||
- **Trust**: Testimonials, guarantees, social proof
|
||||
- **Joy/Happiness**: Benefits, positive outcomes, aspirational messaging
|
||||
- **Urgency**: Time-sensitive offers, countdown timers
|
||||
- **Belonging**: Community, exclusivity, shared values
|
||||
""")
|
||||
|
||||
# Main input form
|
||||
with st.expander("✍️ Create Your Emotional Copy", expanded=True):
|
||||
col1, col2 = st.columns([1, 1])
|
||||
|
||||
with col1:
|
||||
brand_name = st.text_input('**Brand/Company Name**',
|
||||
help="Enter the name of your brand or company.")
|
||||
|
||||
target_audience = st.text_input('**Target Audience**',
|
||||
help="Who is your ideal customer? (e.g., 'busy moms', 'tech-savvy millennials')")
|
||||
|
||||
emotional_trigger = st.selectbox(
|
||||
'**Primary Emotional Trigger**',
|
||||
options=['Trust', 'Fear of Missing Out', 'Joy/Happiness', 'Urgency', 'Belonging', 'Exclusivity'],
|
||||
help="Select the primary emotion you want to evoke in your audience."
|
||||
)
|
||||
|
||||
with col2:
|
||||
description = st.text_input('**Brand Description** (In 5-6 words)',
|
||||
help="Describe your product or service briefly.")
|
||||
|
||||
unique_selling_point = st.text_input('**Unique Selling Point**',
|
||||
help="What makes your product/service different from competitors?")
|
||||
|
||||
call_to_action = st.text_input('**Desired Call to Action**',
|
||||
help="What action do you want your audience to take? (e.g., 'Sign up now', 'Buy today')")
|
||||
|
||||
trust_elements = st.text_area('**Trust Elements**',
|
||||
help="Build trust and credibility by showcasing testimonials, guarantees, or endorsements.",
|
||||
placeholder="Testimonials from satisfied customers...\nOur guarantee that...\nIndustry certifications...")
|
||||
|
||||
tone_style = st.selectbox(
|
||||
'**Copy Tone & Style**',
|
||||
options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'],
|
||||
help="Select the tone and style for your copy."
|
||||
)
|
||||
|
||||
if st.button('**Generate Emotional Copy**', type="primary"):
|
||||
if not brand_name or not description or not trust_elements:
|
||||
st.error("⚠️ Please fill in all required fields (Brand Name, Description, and Trust Elements)!")
|
||||
else:
|
||||
with st.spinner("✨ Crafting emotionally compelling copy..."):
|
||||
emotional_copy = generate_emotional_copy(
|
||||
brand_name,
|
||||
description,
|
||||
trust_elements,
|
||||
target_audience,
|
||||
emotional_trigger,
|
||||
unique_selling_point,
|
||||
call_to_action,
|
||||
tone_style
|
||||
)
|
||||
|
||||
if emotional_copy:
|
||||
st.markdown("""
|
||||
<div style='background-color: #e6f7ff; padding: 20px; border-radius: 10px; margin-top: 20px;'>
|
||||
<h3 style='color: #0066cc;'>🎯 Your Emotional Copy</h3>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Display the copy with a nice format
|
||||
st.markdown(emotional_copy)
|
||||
|
||||
# Add copy button
|
||||
st.markdown("""
|
||||
<div style='margin-top: 20px;'>
|
||||
<button style='background-color: #4CAF50; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer;'>
|
||||
Copy to Clipboard
|
||||
</button>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Add tips for using the copy - using a container instead of an expander
|
||||
st.markdown("""
|
||||
<div style='background-color: #f9f9f9; padding: 15px; border-radius: 10px; margin-top: 20px;'>
|
||||
<h3 style='color: #333;'>💡 Tips for Using Your Emotional Copy</h3>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
st.markdown("""
|
||||
### How to Use Your Emotional Copy Effectively
|
||||
|
||||
1. **Test different versions**: A/B test your copy to see which emotional triggers resonate most with your audience
|
||||
|
||||
2. **Pair with visuals**: Combine your copy with images that reinforce the emotional message
|
||||
|
||||
3. **Consider the context**: Adapt the copy based on where it will appear (social media, email, website, etc.)
|
||||
|
||||
4. **Measure results**: Track engagement metrics to see how your emotional copy performs
|
||||
|
||||
5. **Refine over time**: Continuously improve your copy based on audience feedback and performance data
|
||||
""")
|
||||
else:
|
||||
st.error("💥 **Failed to generate Emotional Copy. Please try again!**")
|
||||
|
||||
|
||||
def generate_emotional_copy(brand_name, description, trust_elements, target_audience, emotional_trigger,
|
||||
unique_selling_point, call_to_action, tone_style):
|
||||
system_prompt = """You are an expert emotional copywriter with years of experience in creating compelling marketing copy
|
||||
that resonates with audiences on a deep emotional level. Your specialty is crafting copy that triggers specific emotions
|
||||
and drives action while maintaining authenticity and credibility."""
|
||||
|
||||
prompt = f"""Create 3 different emotional marketing campaigns for {brand_name}, which is a {description}.
|
||||
|
||||
TARGET AUDIENCE: {target_audience}
|
||||
PRIMARY EMOTIONAL TRIGGER: {emotional_trigger}
|
||||
UNIQUE SELLING POINT: {unique_selling_point}
|
||||
DESIRED CALL TO ACTION: {call_to_action}
|
||||
TONE & STYLE: {tone_style}
|
||||
TRUST ELEMENTS: {trust_elements}
|
||||
|
||||
For each campaign:
|
||||
1. Create a compelling headline that captures attention
|
||||
2. Write 2-3 paragraphs of body copy that builds emotional connection
|
||||
3. End with a strong call to action
|
||||
4. Explain which emotional triggers you used and why they're effective for this audience
|
||||
|
||||
Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers.
|
||||
Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires.
|
||||
"""
|
||||
|
||||
try:
|
||||
return llm_text_gen(prompt, system_prompt=system_prompt)
|
||||
except Exception as e:
|
||||
st.error(f"Error generating copy: {str(e)}")
|
||||
return None
|
||||
211
ToBeMigrated/ai_writers/ai_copywriter/aida_copywriter.py
Normal file
211
ToBeMigrated/ai_writers/ai_copywriter/aida_copywriter.py
Normal file
@@ -0,0 +1,211 @@
|
||||
import streamlit as st
|
||||
from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen
|
||||
from tenacity import retry, wait_random_exponential, stop_after_attempt
|
||||
|
||||
def input_section():
|
||||
st.markdown("""
|
||||
<div style='background-color: #f0f2f6; padding: 20px; border-radius: 10px; margin-bottom: 20px;'>
|
||||
<h2 style='color: #1E88E5;'>🎯 AIDA Copywriting Generator</h2>
|
||||
<p>Create compelling copy that follows the AIDA (Attention-Interest-Desire-Action) framework to drive conversions.</p>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Educational content about AIDA copywriting
|
||||
with st.expander("📚 What is AIDA Copywriting?", expanded=False):
|
||||
st.markdown("""
|
||||
### Understanding the AIDA Copywriting Framework
|
||||
|
||||
AIDA is an acronym for Attention-Interest-Desire-Action. It's a classic copywriting framework that guides your audience through a complete journey:
|
||||
|
||||
- **Attention**: Capturing the audience's attention with a compelling headline or hook
|
||||
- **Interest**: Generating interest by highlighting benefits or addressing pain points
|
||||
- **Desire**: Creating desire by showcasing how the product/service solves problems or fulfills needs
|
||||
- **Action**: Prompting the audience to take a specific action with a strong call to action
|
||||
|
||||
### Why AIDA Copywriting Works
|
||||
|
||||
The AIDA framework works because it:
|
||||
|
||||
- Follows the natural decision-making process of consumers
|
||||
- Addresses all key elements needed for conversion
|
||||
- Creates a complete journey from awareness to action
|
||||
- Balances emotional and rational appeals
|
||||
- Focuses on the customer's journey rather than just product features
|
||||
|
||||
### When to Use AIDA Copywriting
|
||||
|
||||
The AIDA framework is particularly effective for:
|
||||
|
||||
- Landing pages and sales pages
|
||||
- Email marketing campaigns
|
||||
- Product descriptions
|
||||
- Direct response advertising
|
||||
- Content that needs to drive specific actions
|
||||
- Marketing materials that need to address objections
|
||||
""")
|
||||
|
||||
# Main input form
|
||||
with st.expander("✍️ Create Your AIDA Copy", expanded=True):
|
||||
col1, col2 = st.columns([1, 1])
|
||||
|
||||
with col1:
|
||||
brand_name = st.text_input('**🏢 Brand/Company Name**',
|
||||
placeholder="e.g., Alwrity",
|
||||
help="Enter the name of your brand or company.")
|
||||
|
||||
target_audience = st.text_input('**👥 Target Audience**',
|
||||
placeholder="e.g., Small business owners, Tech professionals",
|
||||
help="Who is your ideal customer? Be specific about demographics and psychographics.")
|
||||
|
||||
attention = st.text_area('**🔔 Attention-Grabbing Hook**',
|
||||
placeholder="e.g., Tired of spending hours writing content that doesn't convert?",
|
||||
help="Create a compelling headline or hook that captures attention.")
|
||||
|
||||
interest = st.text_area('**💡 Generate Interest**',
|
||||
placeholder="e.g., Imagine creating high-quality content in minutes instead of hours...",
|
||||
help="Highlight benefits or address pain points to generate interest.")
|
||||
|
||||
with col2:
|
||||
description = st.text_input('**📝 Brand Description** (In 5-6 words)',
|
||||
placeholder="e.g., AI writing tools",
|
||||
help="Describe your product or service briefly.")
|
||||
|
||||
unique_selling_point = st.text_input('**💎 Unique Selling Point**',
|
||||
placeholder="e.g., 10x faster content creation",
|
||||
help="What makes your product/service different from competitors?")
|
||||
|
||||
desire = st.text_area('**❤️ Create Desire**',
|
||||
placeholder="e.g., Our AI analyzes top-performing content to ensure your copy resonates with your target audience...",
|
||||
help="Showcase how your product/service solves problems or fulfills needs.")
|
||||
|
||||
action = st.text_area('**🚀 Call to Action**',
|
||||
placeholder="e.g., Start creating converting content today with our 14-day free trial...",
|
||||
help="Prompt your audience to take action with a strong call to action.")
|
||||
|
||||
landing_page_url = st.text_input('**🌐 Landing Page URL** (Optional)',
|
||||
placeholder="e.g., https://alwrity.com",
|
||||
help="Provide a URL to include in your call to action.")
|
||||
|
||||
col1, col2 = st.columns([1, 1])
|
||||
with col1:
|
||||
platform = st.selectbox(
|
||||
'**📱 Content Platform**',
|
||||
options=['Social media copy', 'Email copy', 'Website copy', 'Ad copy', 'Product copy'],
|
||||
help="Select the platform where your copy will be used."
|
||||
)
|
||||
|
||||
with col2:
|
||||
language = st.selectbox(
|
||||
'**🌍 Language**',
|
||||
options=['English', 'Hindustani', 'Chinese', 'Hindi', 'Spanish'],
|
||||
help="Select the language for your copy."
|
||||
)
|
||||
|
||||
tone_style = st.selectbox(
|
||||
'**🎭 Copy Tone & Style**',
|
||||
options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'],
|
||||
help="Select the tone and style for your copy."
|
||||
)
|
||||
|
||||
if st.button('**🚀 Generate AIDA Copy**', type="primary"):
|
||||
if not brand_name or not description or not attention or not interest or not desire or not action:
|
||||
st.error("⚠️ Please fill in all required fields (Brand Name, Description, and all AIDA elements)!")
|
||||
else:
|
||||
with st.spinner("✨ Crafting compelling AIDA copy..."):
|
||||
aida_copy = generate_aida_copy(
|
||||
brand_name,
|
||||
description,
|
||||
attention,
|
||||
interest,
|
||||
desire,
|
||||
action,
|
||||
target_audience,
|
||||
unique_selling_point,
|
||||
landing_page_url,
|
||||
platform,
|
||||
language,
|
||||
tone_style
|
||||
)
|
||||
|
||||
if aida_copy:
|
||||
st.markdown("""
|
||||
<div style='background-color: #e6f7ff; padding: 20px; border-radius: 10px; margin-top: 20px;'>
|
||||
<h3 style='color: #0066cc;'>🎯 Your AIDA Copy</h3>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Display the copy with a nice format
|
||||
st.markdown(aida_copy)
|
||||
|
||||
# Add copy button
|
||||
st.markdown("""
|
||||
<div style='margin-top: 20px;'>
|
||||
<button style='background-color: #4CAF50; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer;'>
|
||||
Copy to Clipboard
|
||||
</button>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Add tips for using the copy
|
||||
with st.expander("💡 Tips for Using Your AIDA Copy", expanded=False):
|
||||
st.markdown("""
|
||||
### How to Use Your AIDA Copy Effectively
|
||||
|
||||
1. **Follow the sequence**: The AIDA framework creates a natural progression - make sure your copy maintains this flow
|
||||
|
||||
2. **Test different hooks**: A/B test different attention-grabbing headlines to see which resonates most with your audience
|
||||
|
||||
3. **Pair with visuals**: Combine your copy with images that reinforce each stage of the AIDA journey
|
||||
|
||||
4. **Consider the context**: Adapt the copy based on where it will appear (landing page, email, social media, etc.)
|
||||
|
||||
5. **Measure results**: Track conversion metrics to see how your AIDA copy performs
|
||||
|
||||
6. **Refine over time**: Continuously improve your copy based on audience feedback and performance data
|
||||
""")
|
||||
else:
|
||||
st.error("💥 **Failed to generate AIDA Copy. Please try again!**")
|
||||
|
||||
|
||||
@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))
|
||||
def generate_aida_copy(brand_name, description, attention, interest, desire, action,
|
||||
target_audience, unique_selling_point, landing_page_url,
|
||||
platform, language, tone_style):
|
||||
system_prompt = """You are an expert copywriter specializing in the AIDA (Attention-Interest-Desire-Action) framework.
|
||||
Your expertise is in creating compelling, conversion-focused marketing copy that guides readers through a complete journey from awareness to action.
|
||||
Your copy is authentic, specific to the brand, and focused on driving measurable results."""
|
||||
|
||||
prompt = f"""Create 3 different marketing campaigns for {brand_name}, which is a {description}.
|
||||
|
||||
TARGET AUDIENCE: {target_audience}
|
||||
UNIQUE SELLING POINT: {unique_selling_point}
|
||||
PLATFORM: {platform}
|
||||
LANGUAGE: {language}
|
||||
TONE & STYLE: {tone_style}
|
||||
|
||||
Use the AIDA framework with these elements:
|
||||
- **Attention**: {attention}
|
||||
- **Interest**: {interest}
|
||||
- **Desire**: {desire}
|
||||
- **Action**: {action}
|
||||
"""
|
||||
|
||||
if landing_page_url:
|
||||
prompt += f"\nInclude the landing page URL ({landing_page_url}) in your call to action."
|
||||
|
||||
prompt += """
|
||||
For each campaign:
|
||||
1. Start with the attention-grabbing hook to capture the audience's attention
|
||||
2. Generate interest by highlighting benefits or addressing pain points
|
||||
3. Create desire by showcasing how the product/service solves problems or fulfills needs
|
||||
4. End with a strong call to action
|
||||
|
||||
Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers.
|
||||
Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires.
|
||||
"""
|
||||
|
||||
try:
|
||||
return llm_text_gen(prompt, system_prompt=system_prompt)
|
||||
except Exception as e:
|
||||
st.error(f"Error generating copy: {str(e)}")
|
||||
return None
|
||||
191
ToBeMigrated/ai_writers/ai_copywriter/aidppc_copywriter.py
Normal file
191
ToBeMigrated/ai_writers/ai_copywriter/aidppc_copywriter.py
Normal file
@@ -0,0 +1,191 @@
|
||||
import streamlit as st
|
||||
from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen
|
||||
from tenacity import retry, wait_random_exponential, stop_after_attempt
|
||||
|
||||
def input_section():
|
||||
st.markdown("""
|
||||
<div style='background-color: #f0f2f6; padding: 20px; border-radius: 10px; margin-bottom: 20px;'>
|
||||
<h2 style='color: #1E88E5;'>🎯 AIDPPC Copywriting Generator</h2>
|
||||
<p>Create compelling copy that follows the AIDPPC (Attention-Interest-Description-Persuasion-Proof-Close) framework to drive conversions.</p>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Educational content about AIDPPC copywriting
|
||||
with st.expander("📚 What is AIDPPC Copywriting?", expanded=False):
|
||||
st.markdown("""
|
||||
### Understanding the AIDPPC Copywriting Framework
|
||||
|
||||
AIDPPC is an acronym for Attention-Interest-Description-Persuasion-Proof-Close. It's a comprehensive copywriting framework that guides your audience through a complete journey:
|
||||
|
||||
- **Attention**: Capturing the audience's attention with a compelling headline or hook
|
||||
- **Interest**: Generating interest by highlighting benefits or addressing pain points
|
||||
- **Description**: Describing your product or service in detail
|
||||
- **Persuasion**: Presenting compelling arguments or incentives to persuade
|
||||
- **Proof**: Providing social proof, testimonials, or guarantees to build credibility
|
||||
- **Close**: Prompting the audience to take action with a strong call to action
|
||||
|
||||
### Why AIDPPC Copywriting Works
|
||||
|
||||
The AIDPPC framework works because it:
|
||||
|
||||
- Follows the natural decision-making process of consumers
|
||||
- Addresses all key elements needed for conversion
|
||||
- Builds credibility through multiple stages
|
||||
- Creates a complete journey from awareness to action
|
||||
- Balances emotional and rational appeals
|
||||
|
||||
### When to Use AIDPPC Copywriting
|
||||
|
||||
The AIDPPC framework is particularly effective for:
|
||||
|
||||
- Landing pages and sales pages
|
||||
- Email marketing campaigns
|
||||
- Product descriptions
|
||||
- Direct response advertising
|
||||
- Content that needs to drive specific actions
|
||||
- Marketing materials that need to address objections
|
||||
""")
|
||||
|
||||
# Main input form
|
||||
with st.expander("✍️ Create Your AIDPPC Copy", expanded=True):
|
||||
col1, col2 = st.columns([1, 1])
|
||||
|
||||
with col1:
|
||||
brand_name = st.text_input('**🏢 Brand/Company Name**',
|
||||
placeholder="e.g., Alwrity",
|
||||
help="Enter the name of your brand or company.")
|
||||
|
||||
target_audience = st.text_input('**👥 Target Audience**',
|
||||
placeholder="e.g., Small business owners, Tech professionals",
|
||||
help="Who is your ideal customer? Be specific about demographics and psychographics.")
|
||||
|
||||
attention = st.text_area('**🔔 Attention-Grabbing Hook**',
|
||||
placeholder="e.g., Tired of spending hours writing content that doesn't convert?",
|
||||
help="Create a compelling headline or hook that captures attention.")
|
||||
|
||||
interest = st.text_area('**💡 Generate Interest**',
|
||||
placeholder="e.g., Imagine creating high-quality content in minutes instead of hours...",
|
||||
help="Highlight benefits or address pain points to generate interest.")
|
||||
|
||||
with col2:
|
||||
description = st.text_input('**📝 Brand Description** (In 2-3 words)',
|
||||
placeholder="e.g., AI writing tools",
|
||||
help="Describe your product or service briefly.")
|
||||
|
||||
unique_selling_point = st.text_input('**💎 Unique Selling Point**',
|
||||
placeholder="e.g., 10x faster content creation",
|
||||
help="What makes your product/service different from competitors?")
|
||||
|
||||
persuasion = st.text_area('**💪 Persuasive Arguments**',
|
||||
placeholder="e.g., Our AI analyzes top-performing content to ensure your copy resonates with your target audience...",
|
||||
help="Present compelling arguments or incentives to persuade your audience.")
|
||||
|
||||
proof = st.text_area('**✅ Social Proof**',
|
||||
placeholder="e.g., Join 10,000+ satisfied customers who have transformed their content strategy...",
|
||||
help="Provide testimonials, statistics, or guarantees to build credibility.")
|
||||
|
||||
close = st.text_area('**🚀 Call to Action**',
|
||||
placeholder="e.g., Start creating converting content today with our 14-day free trial...",
|
||||
help="Prompt your audience to take action with a strong call to action.")
|
||||
|
||||
tone_style = st.selectbox(
|
||||
'**🎭 Copy Tone & Style**',
|
||||
options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'],
|
||||
help="Select the tone and style for your copy."
|
||||
)
|
||||
|
||||
if st.button('**🚀 Generate AIDPPC Copy**', type="primary"):
|
||||
if not brand_name or not description or not attention or not interest or not persuasion or not proof or not close:
|
||||
st.error("⚠️ Please fill in all required fields (Brand Name, Description, and all AIDPPC elements)!")
|
||||
else:
|
||||
with st.spinner("✨ Crafting compelling AIDPPC copy..."):
|
||||
aidppc_copy = generate_aidppc_copy(
|
||||
brand_name,
|
||||
description,
|
||||
attention,
|
||||
interest,
|
||||
persuasion,
|
||||
proof,
|
||||
close,
|
||||
target_audience,
|
||||
unique_selling_point,
|
||||
tone_style
|
||||
)
|
||||
|
||||
if aidppc_copy:
|
||||
st.markdown("""
|
||||
<div style='background-color: #e6f7ff; padding: 20px; border-radius: 10px; margin-top: 20px;'>
|
||||
<h3 style='color: #0066cc;'>🎯 Your AIDPPC Copy</h3>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Display the copy with a nice format
|
||||
st.markdown(aidppc_copy)
|
||||
|
||||
# Add copy button
|
||||
st.markdown("""
|
||||
<div style='margin-top: 20px;'>
|
||||
<button style='background-color: #4CAF50; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer;'>
|
||||
Copy to Clipboard
|
||||
</button>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Add tips for using the copy
|
||||
with st.expander("💡 Tips for Using Your AIDPPC Copy", expanded=False):
|
||||
st.markdown("""
|
||||
### How to Use Your AIDPPC Copy Effectively
|
||||
|
||||
1. **Follow the sequence**: The AIDPPC framework creates a natural progression - make sure your copy maintains this flow
|
||||
|
||||
2. **Test different hooks**: A/B test different attention-grabbing headlines to see which resonates most with your audience
|
||||
|
||||
3. **Pair with visuals**: Combine your copy with images that reinforce each stage of the AIDPPC journey
|
||||
|
||||
4. **Consider the context**: Adapt the copy based on where it will appear (landing page, email, social media, etc.)
|
||||
|
||||
5. **Measure results**: Track conversion metrics to see how your AIDPPC copy performs
|
||||
|
||||
6. **Refine over time**: Continuously improve your copy based on audience feedback and performance data
|
||||
""")
|
||||
else:
|
||||
st.error("💥 **Failed to generate AIDPPC Copy. Please try again!**")
|
||||
|
||||
|
||||
@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))
|
||||
def generate_aidppc_copy(brand_name, description, attention, interest, persuasion, proof, close,
|
||||
target_audience, unique_selling_point, tone_style):
|
||||
system_prompt = """You are an expert copywriter specializing in the AIDPPC (Attention-Interest-Description-Persuasion-Proof-Close) framework.
|
||||
Your expertise is in creating compelling, conversion-focused marketing copy that guides readers through a complete journey from awareness to action.
|
||||
Your copy is authentic, specific to the brand, and focused on driving measurable results."""
|
||||
|
||||
prompt = f"""Create 3 different marketing campaigns for {brand_name}, which is a {description}.
|
||||
|
||||
TARGET AUDIENCE: {target_audience}
|
||||
UNIQUE SELLING POINT: {unique_selling_point}
|
||||
TONE & STYLE: {tone_style}
|
||||
|
||||
Use the AIDPPC framework with these elements:
|
||||
- **Attention**: {attention}
|
||||
- **Interest**: {interest}
|
||||
- **Persuasion**: {persuasion}
|
||||
- **Proof**: {proof}
|
||||
- **Close**: {close}
|
||||
|
||||
For each campaign:
|
||||
1. Start with the attention-grabbing hook to capture the audience's attention
|
||||
2. Generate interest by highlighting benefits or addressing pain points
|
||||
3. Describe your product or service in detail
|
||||
4. Present persuasive arguments or incentives
|
||||
5. Provide social proof, testimonials, or guarantees
|
||||
6. End with a strong call to action
|
||||
|
||||
Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers.
|
||||
Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires.
|
||||
"""
|
||||
|
||||
try:
|
||||
return llm_text_gen(prompt, system_prompt=system_prompt)
|
||||
except Exception as e:
|
||||
st.error(f"Error generating copy: {str(e)}")
|
||||
return None
|
||||
176
ToBeMigrated/ai_writers/ai_copywriter/app_copywriter.py
Normal file
176
ToBeMigrated/ai_writers/ai_copywriter/app_copywriter.py
Normal file
@@ -0,0 +1,176 @@
|
||||
import streamlit as st
|
||||
from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen
|
||||
|
||||
def input_section():
|
||||
st.markdown("""
|
||||
<div style='background-color: #f0f2f6; padding: 20px; border-radius: 10px; margin-bottom: 20px;'>
|
||||
<h2 style='color: #1E88E5;'>🔍 APP Copywriting Generator</h2>
|
||||
<p>Create compelling marketing copy using the proven APP (Agree-Promise-Preview) formula.</p>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Educational content about APP copywriting
|
||||
with st.expander("📚 What is APP Copywriting?", expanded=False):
|
||||
st.markdown("""
|
||||
### Understanding the APP Copywriting Formula
|
||||
|
||||
The APP formula is a powerful copywriting framework that creates a natural connection with your audience:
|
||||
|
||||
- **Agree**: Acknowledge a shared problem or pain point your audience faces
|
||||
- **Promise**: Make a compelling promise or offer a solution to that problem
|
||||
- **Preview**: Provide a preview of how your solution will deliver on that promise
|
||||
|
||||
### Why APP Copywriting Works
|
||||
|
||||
The APP formula works because it:
|
||||
|
||||
- Creates immediate rapport by showing you understand your audience's challenges
|
||||
- Builds trust by acknowledging problems before selling solutions
|
||||
- Reduces resistance by connecting on a human level first
|
||||
- Demonstrates empathy and understanding
|
||||
- Follows a natural conversation flow that feels authentic
|
||||
|
||||
### When to Use APP Copywriting
|
||||
|
||||
The APP formula is particularly effective for:
|
||||
|
||||
- Building trust with new audiences
|
||||
- Introducing new products or services
|
||||
- Addressing common objections
|
||||
- Creating relatable content
|
||||
- Establishing your brand as a solution provider
|
||||
- Email marketing sequences
|
||||
""")
|
||||
|
||||
# Main input form
|
||||
with st.expander("✍️ Create Your APP Copy", expanded=True):
|
||||
col1, col2 = st.columns([1, 1])
|
||||
|
||||
with col1:
|
||||
brand_name = st.text_input('**🏢 Brand/Company Name**',
|
||||
placeholder="e.g., Alwrity",
|
||||
help="Enter the name of your brand or company.")
|
||||
|
||||
target_audience = st.text_input('**👥 Target Audience**',
|
||||
placeholder="e.g., Small business owners, Tech professionals",
|
||||
help="Who is your ideal customer? Be specific about demographics and psychographics.")
|
||||
|
||||
agree = st.text_area('**🤝 Agree (Shared Problem)**',
|
||||
placeholder="We all face..., Like you, I've..., Safety, Unprofessionalism..",
|
||||
help="Connect with the audience by acknowledging a shared problem or pain point they face.")
|
||||
|
||||
with col2:
|
||||
description = st.text_input('**📝 Brand Description** (In 2-3 words)',
|
||||
placeholder="e.g., AI writing tools",
|
||||
help="Describe your product or service briefly.")
|
||||
|
||||
unique_selling_point = st.text_input('**💎 Unique Selling Point**',
|
||||
placeholder="e.g., 10x faster content creation",
|
||||
help="What makes your product/service different from competitors?")
|
||||
|
||||
promise = st.text_area('**✨ Promise (Solution)**',
|
||||
placeholder="We guarantee..., Our solution ensures..., You'll never have to worry about...",
|
||||
help="Make a compelling promise or offer a solution to the problem.")
|
||||
|
||||
preview = st.text_area('**🔮 Preview (Proof)**',
|
||||
placeholder="Here's how..., Our customers have experienced..., You'll see results like...",
|
||||
help="Provide a preview of how your solution will deliver on the promise.")
|
||||
|
||||
tone_style = st.selectbox(
|
||||
'**🎭 Copy Tone & Style**',
|
||||
options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'],
|
||||
help="Select the tone and style for your copy."
|
||||
)
|
||||
|
||||
if st.button('**🚀 Generate APP Copy**', type="primary"):
|
||||
if not brand_name or not description or not agree or not promise or not preview:
|
||||
st.error("⚠️ Please fill in all required fields (Brand Name, Description, Agree, Promise, and Preview)!")
|
||||
else:
|
||||
with st.spinner("✨ Crafting compelling APP copy..."):
|
||||
app_copy = generate_app_copy(
|
||||
brand_name,
|
||||
description,
|
||||
agree,
|
||||
target_audience,
|
||||
unique_selling_point,
|
||||
promise,
|
||||
preview,
|
||||
tone_style
|
||||
)
|
||||
|
||||
if app_copy:
|
||||
st.markdown("""
|
||||
<div style='background-color: #e6f7ff; padding: 20px; border-radius: 10px; margin-top: 20px;'>
|
||||
<h3 style='color: #0066cc;'>✨ Your APP Copy</h3>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Display the copy with a nice format
|
||||
st.markdown(app_copy)
|
||||
|
||||
# Add copy button
|
||||
st.markdown("""
|
||||
<div style='margin-top: 20px;'>
|
||||
<button style='background-color: #4CAF50; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer;'>
|
||||
Copy to Clipboard
|
||||
</button>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Add tips for using the copy - using a container instead of an expander
|
||||
st.markdown("""
|
||||
<div style='background-color: #f9f9f9; padding: 15px; border-radius: 10px; margin-top: 20px;'>
|
||||
<h3 style='color: #333;'>💡 Tips for Using Your APP Copy</h3>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
st.markdown("""
|
||||
### How to Use Your APP Copy Effectively
|
||||
|
||||
1. **Test different versions**: A/B test your copy to see which version resonates most with your audience
|
||||
|
||||
2. **Pair with visuals**: Combine your copy with images that reinforce each stage of the APP formula
|
||||
|
||||
3. **Consider the platform**: Adapt your copy based on where it will appear (social media, email, website, etc.)
|
||||
|
||||
4. **Measure results**: Track engagement metrics to see how your APP copy performs
|
||||
|
||||
5. **Refine over time**: Continuously improve your copy based on audience feedback and performance data
|
||||
""")
|
||||
else:
|
||||
st.error("💥 **Failed to generate APP Copy. Please try again!**")
|
||||
|
||||
|
||||
def generate_app_copy(brand_name, description, agree, target_audience, unique_selling_point,
|
||||
promise, preview, tone_style):
|
||||
system_prompt = """You are an expert copywriter specializing in the APP (Agree-Promise-Preview) formula.
|
||||
Your expertise is in creating compelling, persuasive marketing copy that builds rapport with audiences by
|
||||
acknowledging their problems, making promises, and providing previews of solutions. Your copy is authentic,
|
||||
specific to the brand, and focused on the target audience's needs."""
|
||||
|
||||
prompt = f"""Create 3 different marketing campaigns for {brand_name}, which is a {description}.
|
||||
|
||||
TARGET AUDIENCE: {target_audience}
|
||||
UNIQUE SELLING POINT: {unique_selling_point}
|
||||
TONE & STYLE: {tone_style}
|
||||
|
||||
Use the APP formula with these elements:
|
||||
- **Agree**: {agree}
|
||||
- **Promise**: {promise}
|
||||
- **Preview**: {preview}
|
||||
|
||||
For each campaign:
|
||||
1. Create a compelling headline that captures attention
|
||||
2. Write 2-3 paragraphs that follow the APP formula
|
||||
3. End with a strong call to action
|
||||
4. Explain how each element of the APP formula is used in the copy
|
||||
|
||||
Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers.
|
||||
Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires.
|
||||
"""
|
||||
|
||||
try:
|
||||
return llm_text_gen(prompt, system_prompt=system_prompt)
|
||||
except Exception as e:
|
||||
st.error(f"Error generating copy: {str(e)}")
|
||||
return None
|
||||
674
ToBeMigrated/ai_writers/ai_copywriter/copywriter_dashboard.py
Normal file
674
ToBeMigrated/ai_writers/ai_copywriter/copywriter_dashboard.py
Normal file
@@ -0,0 +1,674 @@
|
||||
import streamlit as st
|
||||
import importlib
|
||||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
import time
|
||||
import json
|
||||
from typing import Dict, List, Callable, Optional, Tuple
|
||||
|
||||
# Add the parent directory to the path to allow importing from lib
|
||||
current_dir = Path(__file__).parent
|
||||
root_dir = current_dir.parent.parent.parent
|
||||
sys.path.append(str(root_dir))
|
||||
|
||||
# Dictionary to store the input section functions
|
||||
input_sections = {}
|
||||
|
||||
# List of copywriter modules to import
|
||||
copywriter_modules = [
|
||||
"ai_emotional_copywriter",
|
||||
"acca_copywriter",
|
||||
"app_copywriter",
|
||||
"star_copywriter",
|
||||
"oath_copywriter",
|
||||
"quest_copywriter",
|
||||
"aidppc_copywriter",
|
||||
"aida_copywriter",
|
||||
"pas_copywriter",
|
||||
"fab_copywriter",
|
||||
"4c_copywriter",
|
||||
"4r_copywriter"
|
||||
]
|
||||
|
||||
# Define formula categories for better organization
|
||||
formula_categories = {
|
||||
"Emotional Appeal": ["ai_emotional_copywriter", "oath_copywriter"],
|
||||
"Structured Framework": ["acca_copywriter", "app_copywriter", "star_copywriter", "quest_copywriter"],
|
||||
"Sales Funnel": ["aidppc_copywriter", "aida_copywriter"],
|
||||
"Problem-Solution": ["pas_copywriter"],
|
||||
"Feature-Benefit": ["fab_copywriter"],
|
||||
"Messaging Framework": ["4c_copywriter", "4r_copywriter"]
|
||||
}
|
||||
|
||||
# Define formula metadata for better display and filtering
|
||||
formula_metadata = {
|
||||
"ai_emotional_copywriter": {
|
||||
"name": "Emotional Copywriter",
|
||||
"icon": "🎭",
|
||||
"description": "Create copy that resonates with your audience's emotions and drives action.",
|
||||
"color": "#FF6B6B",
|
||||
"difficulty": "Intermediate",
|
||||
"best_for": ["Landing Pages", "Email", "Social Media"],
|
||||
"tags": ["emotional", "persuasive", "engagement"]
|
||||
},
|
||||
"acca_copywriter": {
|
||||
"name": "ACCA Copywriter",
|
||||
"icon": "🎯",
|
||||
"description": "Use the ACCA (Attention, Context, Content, Action) framework to create compelling copy.",
|
||||
"color": "#4ECDC4",
|
||||
"difficulty": "Beginner",
|
||||
"best_for": ["Ads", "Email", "Landing Pages"],
|
||||
"tags": ["structured", "conversion", "clear"]
|
||||
},
|
||||
"app_copywriter": {
|
||||
"name": "APP Copywriter",
|
||||
"icon": "🤝",
|
||||
"description": "Implement the APP (Agree, Promise, Preview) formula to create persuasive copy.",
|
||||
"color": "#45B7D1",
|
||||
"difficulty": "Beginner",
|
||||
"best_for": ["Blog Posts", "Sales Pages", "Email"],
|
||||
"tags": ["persuasive", "agreement", "preview"]
|
||||
},
|
||||
"star_copywriter": {
|
||||
"name": "STAR Copywriter",
|
||||
"icon": "⭐",
|
||||
"description": "Use the STAR (Situation, Task, Action, Result) framework to tell compelling stories.",
|
||||
"color": "#FFD166",
|
||||
"difficulty": "Intermediate",
|
||||
"best_for": ["Case Studies", "Testimonials", "About Pages"],
|
||||
"tags": ["storytelling", "results", "case-study"]
|
||||
},
|
||||
"oath_copywriter": {
|
||||
"name": "OATH Copywriter",
|
||||
"icon": "📜",
|
||||
"description": "Apply the OATH (Oblivious, Apathetic, Thinking, Hurting) framework to target specific audience mindsets.",
|
||||
"color": "#06D6A0",
|
||||
"difficulty": "Advanced",
|
||||
"best_for": ["Ads", "Landing Pages", "Email Sequences"],
|
||||
"tags": ["audience", "mindset", "targeting"]
|
||||
},
|
||||
"quest_copywriter": {
|
||||
"name": "QUEST Copywriter",
|
||||
"icon": "🔍",
|
||||
"description": "Use the QUEST (Question, Unpack, Emphasize, Solution, Transform) framework for narrative-driven copy.",
|
||||
"color": "#118AB2",
|
||||
"difficulty": "Intermediate",
|
||||
"best_for": ["Long-form Content", "Sales Pages", "Video Scripts"],
|
||||
"tags": ["narrative", "transformation", "solution"]
|
||||
},
|
||||
"aidppc_copywriter": {
|
||||
"name": "AIDPPC Copywriter",
|
||||
"icon": "💰",
|
||||
"description": "Implement the AIDPPC (Attention, Interest, Desire, Proof, Persuasion, Call to Action) framework for PPC ads.",
|
||||
"color": "#073B4C",
|
||||
"difficulty": "Advanced",
|
||||
"best_for": ["PPC Ads", "Social Ads", "Display Ads"],
|
||||
"tags": ["advertising", "ppc", "conversion"]
|
||||
},
|
||||
"aida_copywriter": {
|
||||
"name": "AIDA Copywriter",
|
||||
"icon": "🎬",
|
||||
"description": "Use the AIDA (Attention, Interest, Desire, Action) framework to guide customers through the sales funnel.",
|
||||
"color": "#EF476F",
|
||||
"difficulty": "Beginner",
|
||||
"best_for": ["Sales Pages", "Email", "Product Descriptions"],
|
||||
"tags": ["sales", "funnel", "conversion"]
|
||||
},
|
||||
"pas_copywriter": {
|
||||
"name": "PAS Copywriter",
|
||||
"icon": "🔧",
|
||||
"description": "Apply the PAS (Problem, Agitate, Solution) formula to address pain points and offer solutions.",
|
||||
"color": "#7209B7",
|
||||
"difficulty": "Beginner",
|
||||
"best_for": ["Ads", "Email", "Landing Pages"],
|
||||
"tags": ["problem-solving", "pain-points", "solutions"]
|
||||
},
|
||||
"fab_copywriter": {
|
||||
"name": "FAB Copywriter",
|
||||
"icon": "💎",
|
||||
"description": "Use the FAB (Features, Advantages, Benefits) framework to highlight product value.",
|
||||
"color": "#3A0CA3",
|
||||
"difficulty": "Beginner",
|
||||
"best_for": ["Product Descriptions", "Sales Pages", "Brochures"],
|
||||
"tags": ["product", "features", "benefits"]
|
||||
},
|
||||
"4c_copywriter": {
|
||||
"name": "4C Copywriter",
|
||||
"icon": "📝",
|
||||
"description": "Implement the 4C (Clear, Concise, Credible, Compelling) framework for effective messaging.",
|
||||
"color": "#4361EE",
|
||||
"difficulty": "Intermediate",
|
||||
"best_for": ["Brand Messaging", "Mission Statements", "Value Propositions"],
|
||||
"tags": ["clarity", "concise", "credibility"]
|
||||
},
|
||||
"4r_copywriter": {
|
||||
"name": "4R Copywriter",
|
||||
"icon": "🔄",
|
||||
"description": "Use the 4R (Relevance, Resonance, Response, Results) framework to connect with your audience.",
|
||||
"color": "#F72585",
|
||||
"difficulty": "Intermediate",
|
||||
"best_for": ["Content Marketing", "Email", "Social Media"],
|
||||
"tags": ["relevance", "resonance", "results"]
|
||||
}
|
||||
}
|
||||
|
||||
def load_user_preferences() -> Dict:
|
||||
"""Load user preferences from session state or initialize if not present."""
|
||||
if "copywriter_preferences" not in st.session_state:
|
||||
st.session_state.copywriter_preferences = {
|
||||
"recent_formulas": [],
|
||||
"favorite_formulas": [],
|
||||
"comparison_formulas": [],
|
||||
"view_mode": "grid" # or "list"
|
||||
}
|
||||
return st.session_state.copywriter_preferences
|
||||
|
||||
def save_user_preferences(preferences: Dict) -> None:
|
||||
"""Save user preferences to session state."""
|
||||
st.session_state.copywriter_preferences = preferences
|
||||
|
||||
def add_recent_formula(module_name: str) -> None:
|
||||
"""Add a formula to the recent formulas list."""
|
||||
preferences = load_user_preferences()
|
||||
|
||||
# Remove if already exists
|
||||
if module_name in preferences["recent_formulas"]:
|
||||
preferences["recent_formulas"].remove(module_name)
|
||||
|
||||
# Add to the beginning of the list
|
||||
preferences["recent_formulas"].insert(0, module_name)
|
||||
|
||||
# Keep only the 5 most recent
|
||||
preferences["recent_formulas"] = preferences["recent_formulas"][:5]
|
||||
|
||||
save_user_preferences(preferences)
|
||||
|
||||
def toggle_favorite_formula(module_name: str) -> bool:
|
||||
"""Toggle a formula as favorite and return the new state."""
|
||||
preferences = load_user_preferences()
|
||||
|
||||
if module_name in preferences["favorite_formulas"]:
|
||||
preferences["favorite_formulas"].remove(module_name)
|
||||
is_favorite = False
|
||||
else:
|
||||
preferences["favorite_formulas"].append(module_name)
|
||||
is_favorite = True
|
||||
|
||||
save_user_preferences(preferences)
|
||||
return is_favorite
|
||||
|
||||
def is_favorite_formula(module_name: str) -> bool:
|
||||
"""Check if a formula is in the favorites list."""
|
||||
preferences = load_user_preferences()
|
||||
return module_name in preferences["favorite_formulas"]
|
||||
|
||||
def add_to_comparison(module_name: str) -> None:
|
||||
"""Add a formula to the comparison list."""
|
||||
preferences = load_user_preferences()
|
||||
|
||||
if module_name not in preferences["comparison_formulas"]:
|
||||
preferences["comparison_formulas"].append(module_name)
|
||||
|
||||
# Keep only up to 3 formulas for comparison
|
||||
preferences["comparison_formulas"] = preferences["comparison_formulas"][:3]
|
||||
|
||||
save_user_preferences(preferences)
|
||||
|
||||
def remove_from_comparison(module_name: str) -> None:
|
||||
"""Remove a formula from the comparison list."""
|
||||
preferences = load_user_preferences()
|
||||
|
||||
if module_name in preferences["comparison_formulas"]:
|
||||
preferences["comparison_formulas"].remove(module_name)
|
||||
|
||||
save_user_preferences(preferences)
|
||||
|
||||
def clear_comparison() -> None:
|
||||
"""Clear the comparison list."""
|
||||
preferences = load_user_preferences()
|
||||
preferences["comparison_formulas"] = []
|
||||
save_user_preferences(preferences)
|
||||
|
||||
def lazy_load_module(module_name: str) -> Optional[Callable]:
|
||||
"""Lazily load a module and return its input_section function."""
|
||||
if module_name in input_sections:
|
||||
return input_sections[module_name]
|
||||
|
||||
try:
|
||||
module_path = f"lib.ai_writers.ai_copywriter.{module_name}"
|
||||
module = importlib.import_module(module_path)
|
||||
if hasattr(module, "input_section"):
|
||||
input_sections[module_name] = module.input_section
|
||||
return module.input_section
|
||||
else:
|
||||
st.warning(f"Module {module_name} does not have an input_section function.")
|
||||
return None
|
||||
except Exception as e:
|
||||
st.error(f"Error loading module {module_name}: {str(e)}")
|
||||
return None
|
||||
|
||||
def render_formula_card(module_name: str, index: int, view_mode: str = "grid") -> None:
|
||||
"""Render a formula card with its details."""
|
||||
metadata = formula_metadata.get(module_name, {})
|
||||
|
||||
if not metadata:
|
||||
return
|
||||
|
||||
is_favorite = is_favorite_formula(module_name)
|
||||
favorite_icon = "★" if is_favorite else "☆"
|
||||
favorite_tooltip = "Remove from favorites" if is_favorite else "Add to favorites"
|
||||
|
||||
if view_mode == "grid":
|
||||
with st.container():
|
||||
st.markdown(f"""
|
||||
<div style='background-color: {metadata["color"]}; padding: 20px; border-radius: 10px; margin-bottom: 20px; color: white; position: relative;'>
|
||||
<div style='position: absolute; top: 10px; right: 10px; font-size: 1.5em;'>{favorite_icon}</div>
|
||||
<h2 style='color: white;'>{metadata["icon"]} {metadata["name"]}</h2>
|
||||
<p>{metadata["description"]}</p>
|
||||
<div style='margin-top: 10px;'>
|
||||
<span style='background-color: rgba(255,255,255,0.2); padding: 3px 8px; border-radius: 10px; margin-right: 5px; font-size: 0.8em;'>
|
||||
{metadata["difficulty"]}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
col1, col2, col3 = st.columns(3)
|
||||
with col1:
|
||||
if st.button(f"Use {metadata['name']}", key=f"use_btn_{index}", use_container_width=True):
|
||||
add_recent_formula(module_name)
|
||||
st.session_state.selected_formula = {
|
||||
"module": module_name,
|
||||
"name": metadata["name"],
|
||||
"icon": metadata["icon"],
|
||||
"function": lazy_load_module(module_name)
|
||||
}
|
||||
st.rerun()
|
||||
|
||||
with col2:
|
||||
if st.button(f"{favorite_icon} Favorite", key=f"fav_btn_{index}", help=favorite_tooltip, use_container_width=True):
|
||||
toggle_favorite_formula(module_name)
|
||||
st.rerun()
|
||||
|
||||
with col3:
|
||||
if module_name in load_user_preferences()["comparison_formulas"]:
|
||||
if st.button("Remove from Compare", key=f"comp_btn_{index}", use_container_width=True):
|
||||
remove_from_comparison(module_name)
|
||||
st.rerun()
|
||||
else:
|
||||
if st.button("Add to Compare", key=f"comp_btn_{index}", use_container_width=True):
|
||||
add_to_comparison(module_name)
|
||||
st.rerun()
|
||||
else: # list view
|
||||
with st.container():
|
||||
col1, col2 = st.columns([3, 1])
|
||||
|
||||
with col1:
|
||||
st.markdown(f"""
|
||||
<div style='padding: 10px; border-left: 5px solid {metadata["color"]}; margin-bottom: 10px;'>
|
||||
<h3>{metadata["icon"]} {metadata["name"]} {favorite_icon}</h3>
|
||||
<p>{metadata["description"]}</p>
|
||||
<div>
|
||||
<span style='background-color: #f0f2f6; padding: 3px 8px; border-radius: 10px; margin-right: 5px; font-size: 0.8em;'>
|
||||
{metadata["difficulty"]}
|
||||
</span>
|
||||
<span style='font-size: 0.8em;'>Best for: {", ".join(metadata["best_for"][:2])}</span>
|
||||
</div>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
with col2:
|
||||
if st.button(f"Use", key=f"use_list_btn_{index}", use_container_width=True):
|
||||
add_recent_formula(module_name)
|
||||
st.session_state.selected_formula = {
|
||||
"module": module_name,
|
||||
"name": metadata["name"],
|
||||
"icon": metadata["icon"],
|
||||
"function": lazy_load_module(module_name)
|
||||
}
|
||||
st.rerun()
|
||||
|
||||
if st.button(f"{favorite_icon}", key=f"fav_list_btn_{index}", help=favorite_tooltip):
|
||||
toggle_favorite_formula(module_name)
|
||||
st.rerun()
|
||||
|
||||
if module_name in load_user_preferences()["comparison_formulas"]:
|
||||
if st.button("- Compare", key=f"comp_list_btn_{index}"):
|
||||
remove_from_comparison(module_name)
|
||||
st.rerun()
|
||||
else:
|
||||
if st.button("+ Compare", key=f"comp_list_btn_{index}"):
|
||||
add_to_comparison(module_name)
|
||||
st.rerun()
|
||||
|
||||
def render_formula_comparison() -> None:
|
||||
"""Render a comparison of selected formulas."""
|
||||
preferences = load_user_preferences()
|
||||
comparison_formulas = preferences["comparison_formulas"]
|
||||
|
||||
if not comparison_formulas:
|
||||
st.info("Add formulas to compare them side by side.")
|
||||
return
|
||||
|
||||
# Create a table for comparison
|
||||
comparison_data = []
|
||||
for module_name in comparison_formulas:
|
||||
metadata = formula_metadata.get(module_name, {})
|
||||
if metadata:
|
||||
comparison_data.append({
|
||||
"Name": f"{metadata['icon']} {metadata['name']}",
|
||||
"Description": metadata["description"],
|
||||
"Difficulty": metadata["difficulty"],
|
||||
"Best For": ", ".join(metadata["best_for"][:3]),
|
||||
"Tags": ", ".join(metadata["tags"])
|
||||
})
|
||||
|
||||
# Display the comparison table
|
||||
st.markdown("### Formula Comparison")
|
||||
|
||||
# Create columns for each formula
|
||||
cols = st.columns(len(comparison_data))
|
||||
|
||||
# Display headers
|
||||
for i, col in enumerate(cols):
|
||||
with col:
|
||||
st.markdown(f"#### {comparison_data[i]['Name']}")
|
||||
|
||||
# Display description
|
||||
st.markdown("##### Description")
|
||||
for i, col in enumerate(cols):
|
||||
with col:
|
||||
st.write(comparison_data[i]["Description"])
|
||||
|
||||
# Display difficulty
|
||||
st.markdown("##### Difficulty")
|
||||
for i, col in enumerate(cols):
|
||||
with col:
|
||||
st.write(comparison_data[i]["Difficulty"])
|
||||
|
||||
# Display best for
|
||||
st.markdown("##### Best For")
|
||||
for i, col in enumerate(cols):
|
||||
with col:
|
||||
st.write(comparison_data[i]["Best For"])
|
||||
|
||||
# Display tags
|
||||
st.markdown("##### Tags")
|
||||
for i, col in enumerate(cols):
|
||||
with col:
|
||||
st.write(comparison_data[i]["Tags"])
|
||||
|
||||
# Add buttons to use each formula
|
||||
st.markdown("##### Actions")
|
||||
for i, col in enumerate(cols):
|
||||
with col:
|
||||
module_name = comparison_formulas[i]
|
||||
if st.button(f"Use {formula_metadata[module_name]['name']}", key=f"use_comp_btn_{i}"):
|
||||
add_recent_formula(module_name)
|
||||
st.session_state.selected_formula = {
|
||||
"module": module_name,
|
||||
"name": formula_metadata[module_name]["name"],
|
||||
"icon": formula_metadata[module_name]["icon"],
|
||||
"function": lazy_load_module(module_name)
|
||||
}
|
||||
st.rerun()
|
||||
|
||||
# Add a button to clear the comparison
|
||||
if st.button("Clear Comparison", key="clear_comparison"):
|
||||
clear_comparison()
|
||||
st.rerun()
|
||||
|
||||
def filter_formulas(formulas: List[str], search_term: str, category: str, difficulty: str) -> List[str]:
|
||||
"""Filter formulas based on search term, category, and difficulty."""
|
||||
filtered_formulas = []
|
||||
|
||||
for module_name in formulas:
|
||||
metadata = formula_metadata.get(module_name, {})
|
||||
if not metadata:
|
||||
continue
|
||||
|
||||
# Check if the formula matches the search term
|
||||
name_match = search_term.lower() in metadata["name"].lower()
|
||||
desc_match = search_term.lower() in metadata["description"].lower()
|
||||
tags_match = any(search_term.lower() in tag.lower() for tag in metadata.get("tags", []))
|
||||
|
||||
# Check if the formula matches the category
|
||||
category_match = True
|
||||
if category != "All Categories":
|
||||
category_match = module_name in formula_categories.get(category, [])
|
||||
|
||||
# Check if the formula matches the difficulty
|
||||
difficulty_match = True
|
||||
if difficulty != "All Difficulties":
|
||||
difficulty_match = metadata.get("difficulty", "") == difficulty
|
||||
|
||||
# Add the formula if it matches all criteria
|
||||
if (name_match or desc_match or tags_match) and category_match and difficulty_match:
|
||||
filtered_formulas.append(module_name)
|
||||
|
||||
return filtered_formulas
|
||||
|
||||
def copywriter_dashboard():
|
||||
"""
|
||||
Main function to display the copywriting dashboard.
|
||||
This function can be called from content_generator.py when the user selects "AI Copywriter".
|
||||
"""
|
||||
# Load user preferences
|
||||
preferences = load_user_preferences()
|
||||
|
||||
# Initialize session state for selected formula if it doesn't exist
|
||||
if "selected_formula" not in st.session_state:
|
||||
st.session_state.selected_formula = None
|
||||
|
||||
# Initialize session state for search and filter options
|
||||
if "search_term" not in st.session_state:
|
||||
st.session_state.search_term = ""
|
||||
if "selected_category" not in st.session_state:
|
||||
st.session_state.selected_category = "All Categories"
|
||||
if "selected_difficulty" not in st.session_state:
|
||||
st.session_state.selected_difficulty = "All Difficulties"
|
||||
if "view_mode" not in st.session_state:
|
||||
st.session_state.view_mode = preferences["view_mode"]
|
||||
|
||||
# Create a container for the formula input section
|
||||
formula_container = st.container()
|
||||
|
||||
# If a formula is selected, show its input section
|
||||
if st.session_state.selected_formula is not None:
|
||||
with formula_container:
|
||||
# Display the selected formula's input section
|
||||
st.markdown("---")
|
||||
st.markdown(f"# {st.session_state.selected_formula['icon']} {st.session_state.selected_formula['name']}")
|
||||
|
||||
# Add a back button
|
||||
if st.button("← Back to Dashboard", key="back_to_dashboard"):
|
||||
# Clear the selected formula from session state
|
||||
st.session_state.selected_formula = None
|
||||
st.rerun()
|
||||
|
||||
# Call the input section function for the selected formula
|
||||
if st.session_state.selected_formula["function"]:
|
||||
st.session_state.selected_formula["function"]()
|
||||
else:
|
||||
st.error(f"The {st.session_state.selected_formula['name']} module is not available.")
|
||||
else:
|
||||
# Create a container for the dashboard
|
||||
dashboard_container = st.container()
|
||||
|
||||
with dashboard_container:
|
||||
# Display the dashboard
|
||||
# Header
|
||||
st.markdown("""
|
||||
<div style='background-color: #f0f2f6; padding: 20px; border-radius: 10px; margin-bottom: 20px;'>
|
||||
<h1 style='color: #1E88E5; text-align: center;'>✍️ AI Copywriting Tools</h1>
|
||||
<p style='text-align: center;'>Choose the perfect copywriting formula for your marketing needs</p>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Create tabs for different sections
|
||||
tab1, tab2, tab3, tab4 = st.tabs(["All Formulas", "Recent & Favorites", "Compare Formulas", "Help & Guide"])
|
||||
|
||||
with tab1:
|
||||
# Search and filter options
|
||||
col1, col2, col3, col4 = st.columns([3, 2, 2, 1])
|
||||
|
||||
with col1:
|
||||
search_term = st.text_input("🔍 Search formulas", value=st.session_state.search_term)
|
||||
if search_term != st.session_state.search_term:
|
||||
st.session_state.search_term = search_term
|
||||
|
||||
with col2:
|
||||
categories = ["All Categories"] + list(formula_categories.keys())
|
||||
selected_category = st.selectbox("Category", categories, index=categories.index(st.session_state.selected_category))
|
||||
if selected_category != st.session_state.selected_category:
|
||||
st.session_state.selected_category = selected_category
|
||||
|
||||
with col3:
|
||||
difficulties = ["All Difficulties", "Beginner", "Intermediate", "Advanced"]
|
||||
selected_difficulty = st.selectbox("Difficulty", difficulties, index=difficulties.index(st.session_state.selected_difficulty))
|
||||
if selected_difficulty != st.session_state.selected_difficulty:
|
||||
st.session_state.selected_difficulty = selected_difficulty
|
||||
|
||||
with col4:
|
||||
view_options = {"Grid": "grid", "List": "list"}
|
||||
view_mode = st.selectbox("View", list(view_options.keys()), index=list(view_options.values()).index(st.session_state.view_mode))
|
||||
st.session_state.view_mode = view_options[view_mode]
|
||||
preferences["view_mode"] = st.session_state.view_mode
|
||||
save_user_preferences(preferences)
|
||||
|
||||
# Filter formulas based on search and filter options
|
||||
filtered_formulas = filter_formulas(
|
||||
copywriter_modules,
|
||||
st.session_state.search_term,
|
||||
st.session_state.selected_category,
|
||||
st.session_state.selected_difficulty
|
||||
)
|
||||
|
||||
if not filtered_formulas:
|
||||
st.info("No formulas match your search criteria. Try adjusting your filters.")
|
||||
else:
|
||||
# Display the formula cards
|
||||
if st.session_state.view_mode == "grid":
|
||||
# Create a 3-column layout for the formula cards
|
||||
col1, col2, col3 = st.columns(3)
|
||||
|
||||
# Display the formula cards
|
||||
for i, module_name in enumerate(filtered_formulas):
|
||||
# Determine which column to use
|
||||
col = col1 if i % 3 == 0 else col2 if i % 3 == 1 else col3
|
||||
|
||||
with col:
|
||||
render_formula_card(module_name, i, st.session_state.view_mode)
|
||||
else: # list view
|
||||
for i, module_name in enumerate(filtered_formulas):
|
||||
render_formula_card(module_name, i, st.session_state.view_mode)
|
||||
|
||||
with tab2:
|
||||
# Recent formulas
|
||||
st.subheader("Recently Used Formulas")
|
||||
recent_formulas = preferences["recent_formulas"]
|
||||
|
||||
if not recent_formulas:
|
||||
st.info("You haven't used any formulas yet. Start by selecting a formula from the 'All Formulas' tab.")
|
||||
else:
|
||||
# Create a 3-column layout for the recent formula cards
|
||||
col1, col2, col3 = st.columns(3)
|
||||
|
||||
# Display the recent formula cards
|
||||
for i, module_name in enumerate(recent_formulas):
|
||||
# Determine which column to use
|
||||
col = col1 if i % 3 == 0 else col2 if i % 3 == 1 else col3
|
||||
|
||||
with col:
|
||||
render_formula_card(module_name, i + 100, "grid") # Use a different index to avoid key conflicts
|
||||
|
||||
# Favorite formulas
|
||||
st.subheader("Favorite Formulas")
|
||||
favorite_formulas = preferences["favorite_formulas"]
|
||||
|
||||
if not favorite_formulas:
|
||||
st.info("You haven't added any formulas to your favorites yet. Click the star icon on a formula card to add it to your favorites.")
|
||||
else:
|
||||
# Create a 3-column layout for the favorite formula cards
|
||||
col1, col2, col3 = st.columns(3)
|
||||
|
||||
# Display the favorite formula cards
|
||||
for i, module_name in enumerate(favorite_formulas):
|
||||
# Determine which column to use
|
||||
col = col1 if i % 3 == 0 else col2 if i % 3 == 1 else col3
|
||||
|
||||
with col:
|
||||
render_formula_card(module_name, i + 200, "grid") # Use a different index to avoid key conflicts
|
||||
|
||||
with tab3:
|
||||
# Formula comparison
|
||||
render_formula_comparison()
|
||||
|
||||
with tab4:
|
||||
# Help and guide
|
||||
st.subheader("Copywriting Formula Guide")
|
||||
st.write("""
|
||||
This dashboard provides access to a variety of copywriting formulas, each designed for specific marketing needs.
|
||||
Here's how to make the most of these powerful tools:
|
||||
""")
|
||||
|
||||
st.markdown("""
|
||||
#### How to Use This Dashboard
|
||||
|
||||
1. **Browse Formulas**: Explore the available copywriting formulas in the "All Formulas" tab
|
||||
2. **Search & Filter**: Use the search box and filters to find the perfect formula for your needs
|
||||
3. **Compare Formulas**: Add up to 3 formulas to the comparison tab to see them side by side
|
||||
4. **Save Favorites**: Click the star icon to save formulas you use frequently
|
||||
5. **Access Recent**: Quickly access your recently used formulas in the "Recent & Favorites" tab
|
||||
|
||||
#### Choosing the Right Formula
|
||||
|
||||
Different formulas work best for different marketing goals:
|
||||
|
||||
- **Emotional Appeal**: Use when you want to connect with your audience on an emotional level
|
||||
- **Structured Framework**: Great for organizing complex information in a compelling way
|
||||
- **Sales Funnel**: Designed to guide prospects through the buying journey
|
||||
- **Problem-Solution**: Effective for highlighting pain points and positioning your solution
|
||||
- **Feature-Benefit**: Perfect for product descriptions and technical offerings
|
||||
- **Messaging Framework**: Helps create clear, consistent messaging across channels
|
||||
|
||||
#### Formula Difficulty Levels
|
||||
|
||||
- **Beginner**: Easy to use with minimal copywriting experience
|
||||
- **Intermediate**: Requires some understanding of copywriting principles
|
||||
- **Advanced**: Most effective when used by experienced copywriters
|
||||
""")
|
||||
|
||||
# Add a section about how to use the generated copy
|
||||
st.subheader("Using Your Generated Copy")
|
||||
st.write("""
|
||||
After generating copy with your chosen formula:
|
||||
|
||||
1. **Review & Edit**: Always review and personalize the generated content
|
||||
2. **Test Different Versions**: Try multiple formulas for the same product/service
|
||||
3. **A/B Test**: Use different versions in your marketing to see which performs best
|
||||
4. **Adapt for Channels**: Modify the copy as needed for different marketing channels
|
||||
""")
|
||||
|
||||
# Add a feedback section
|
||||
st.subheader("Feedback & Suggestions")
|
||||
st.write("We're constantly improving our copywriting tools. If you have feedback or suggestions, please let us know!")
|
||||
|
||||
feedback = st.text_area("Your feedback", placeholder="Share your thoughts, suggestions, or report any issues...")
|
||||
if st.button("Submit Feedback"):
|
||||
if feedback:
|
||||
st.success("Thank you for your feedback! We'll use it to improve our tools.")
|
||||
# In a real implementation, you would save this feedback somewhere
|
||||
else:
|
||||
st.warning("Please enter your feedback before submitting.")
|
||||
|
||||
# For standalone execution
|
||||
if __name__ == "__main__":
|
||||
st.set_page_config(
|
||||
page_title="AI Copywriting Tools",
|
||||
page_icon="✍️",
|
||||
layout="wide",
|
||||
initial_sidebar_state="expanded"
|
||||
)
|
||||
copywriter_dashboard()
|
||||
212
ToBeMigrated/ai_writers/ai_copywriter/fab_copywriter.py
Normal file
212
ToBeMigrated/ai_writers/ai_copywriter/fab_copywriter.py
Normal file
@@ -0,0 +1,212 @@
|
||||
import streamlit as st
|
||||
from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen
|
||||
from tenacity import retry, wait_random_exponential, stop_after_attempt
|
||||
|
||||
def input_section():
|
||||
st.markdown("""
|
||||
<div style='background-color: #f0f2f6; padding: 20px; border-radius: 10px; margin-bottom: 20px;'>
|
||||
<h2 style='color: #1E88E5;'>🎯 FAB Copywriting Generator</h2>
|
||||
<p>Create compelling copy that follows the FAB (Features-Advantages-Benefits) framework to drive conversions.</p>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Educational content about FAB copywriting
|
||||
with st.expander("📚 What is FAB Copywriting?", expanded=False):
|
||||
st.markdown("""
|
||||
### Understanding the FAB Copywriting Framework
|
||||
|
||||
FAB is an acronym for Features-Advantages-Benefits. It's a powerful copywriting framework that focuses on translating product features into customer benefits:
|
||||
|
||||
- **Features**: The specific characteristics, attributes, or capabilities of your product or service
|
||||
- **Advantages**: How these features compare to or outperform competitors
|
||||
- **Benefits**: The positive outcomes or results that customers will experience when using your product or service
|
||||
|
||||
### Why FAB Copywriting Works
|
||||
|
||||
The FAB framework works because it:
|
||||
|
||||
- Focuses on customer value rather than just product specifications
|
||||
- Translates technical features into meaningful benefits
|
||||
- Addresses the "what's in it for me" question that customers ask
|
||||
- Creates a clear connection between product capabilities and customer outcomes
|
||||
- Helps customers understand why they should choose your product over alternatives
|
||||
|
||||
### When to Use FAB Copywriting
|
||||
|
||||
The FAB framework is particularly effective for:
|
||||
|
||||
- Product descriptions and specifications
|
||||
- Technical products with complex features
|
||||
- Comparison marketing
|
||||
- B2B marketing where features matter
|
||||
- Content that needs to explain product capabilities
|
||||
- Marketing materials that need to address feature-based objections
|
||||
""")
|
||||
|
||||
# Main input form
|
||||
with st.expander("✍️ Create Your FAB Copy", expanded=True):
|
||||
col1, col2 = st.columns([1, 1])
|
||||
|
||||
with col1:
|
||||
product_name = st.text_input('**🏢 Product/Service Name**',
|
||||
placeholder="e.g., Alwrity AI Writer",
|
||||
help="Enter the name of your product or service.")
|
||||
|
||||
target_audience = st.text_input('**👥 Target Audience**',
|
||||
placeholder="e.g., Small business owners, Content marketers",
|
||||
help="Who is your ideal customer? Be specific about demographics and psychographics.")
|
||||
|
||||
features = st.text_area('**🔧 Features**',
|
||||
placeholder="e.g., AI-powered content generation, Multiple copywriting frameworks, SEO optimization",
|
||||
help="List the specific characteristics, attributes, or capabilities of your product or service.")
|
||||
|
||||
advantages = st.text_area('**💪 Advantages**',
|
||||
placeholder="e.g., 10x faster than manual writing, Supports 12+ copywriting frameworks, Built-in SEO analysis",
|
||||
help="How do these features compare to or outperform competitors?")
|
||||
|
||||
with col2:
|
||||
product_description = st.text_input('**📝 Product Description** (In 5-6 words)',
|
||||
placeholder="e.g., AI writing assistant",
|
||||
help="Describe your product or service briefly.")
|
||||
|
||||
unique_selling_point = st.text_input('**💎 Unique Selling Point**',
|
||||
placeholder="e.g., All-in-one AI copywriting platform",
|
||||
help="What makes your product/service different from competitors?")
|
||||
|
||||
benefits = st.text_area('**✨ Benefits**',
|
||||
placeholder="e.g., Save 20+ hours per week on content creation, Increase conversion rates by 35%, Improve SEO rankings",
|
||||
help="What positive outcomes or results will customers experience when using your product or service?")
|
||||
|
||||
call_to_action = st.text_area('**🚀 Call to Action**',
|
||||
placeholder="e.g., Start creating high-converting content today with our 14-day free trial...",
|
||||
help="Prompt your audience to take action with a strong call to action.")
|
||||
|
||||
landing_page_url = st.text_input('**🌐 Landing Page URL** (Optional)',
|
||||
placeholder="e.g., https://alwrity.com",
|
||||
help="Provide a URL to include in your call to action.")
|
||||
|
||||
col1, col2 = st.columns([1, 1])
|
||||
with col1:
|
||||
platform = st.selectbox(
|
||||
'**📱 Content Platform**',
|
||||
options=['Social media copy', 'Email copy', 'Website copy', 'Ad copy', 'Product copy'],
|
||||
help="Select the platform where your copy will be used."
|
||||
)
|
||||
|
||||
with col2:
|
||||
language = st.selectbox(
|
||||
'**🌍 Language**',
|
||||
options=['English', 'Hindustani', 'Chinese', 'Hindi', 'Spanish'],
|
||||
help="Select the language for your copy."
|
||||
)
|
||||
|
||||
tone_style = st.selectbox(
|
||||
'**🎭 Copy Tone & Style**',
|
||||
options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'],
|
||||
help="Select the tone and style for your copy."
|
||||
)
|
||||
|
||||
if st.button('**🚀 Generate FAB Copy**', type="primary"):
|
||||
if not product_name or not product_description or not features or not advantages or not benefits:
|
||||
st.error("⚠️ Please fill in all required fields (Product Name, Description, Features, Advantages, and Benefits)!")
|
||||
else:
|
||||
with st.spinner("✨ Crafting compelling FAB copy..."):
|
||||
fab_copy = generate_fab_copy(
|
||||
product_name,
|
||||
product_description,
|
||||
features,
|
||||
advantages,
|
||||
benefits,
|
||||
target_audience,
|
||||
unique_selling_point,
|
||||
call_to_action,
|
||||
landing_page_url,
|
||||
platform,
|
||||
language,
|
||||
tone_style
|
||||
)
|
||||
|
||||
if fab_copy:
|
||||
st.markdown("""
|
||||
<div style='background-color: #e6f7ff; padding: 20px; border-radius: 10px; margin-top: 20px;'>
|
||||
<h3 style='color: #0066cc;'>🎯 Your FAB Copy</h3>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Display the copy with a nice format
|
||||
st.markdown(fab_copy)
|
||||
|
||||
# Add copy button
|
||||
st.markdown("""
|
||||
<div style='margin-top: 20px;'>
|
||||
<button style='background-color: #4CAF50; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer;'>
|
||||
Copy to Clipboard
|
||||
</button>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Add tips for using the copy
|
||||
with st.expander("💡 Tips for Using Your FAB Copy", expanded=False):
|
||||
st.markdown("""
|
||||
### How to Use Your FAB Copy Effectively
|
||||
|
||||
1. **Follow the sequence**: The FAB framework creates a natural progression - make sure your copy maintains this flow
|
||||
|
||||
2. **Balance features and benefits**: While benefits are most important, don't neglect features for technical audiences
|
||||
|
||||
3. **Be specific**: Use concrete numbers, statistics, and examples to make your advantages and benefits more compelling
|
||||
|
||||
4. **Pair with visuals**: Combine your copy with images that showcase your product features and the resulting benefits
|
||||
|
||||
5. **Consider the context**: Adapt the copy based on where it will appear (landing page, email, social media, etc.)
|
||||
|
||||
6. **Measure results**: Track conversion metrics to see how your FAB copy performs
|
||||
|
||||
7. **Refine over time**: Continuously improve your copy based on audience feedback and performance data
|
||||
""")
|
||||
else:
|
||||
st.error("💥 **Failed to generate FAB Copy. Please try again!**")
|
||||
|
||||
|
||||
@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))
|
||||
def generate_fab_copy(product_name, product_description, features, advantages, benefits,
|
||||
target_audience, unique_selling_point, call_to_action,
|
||||
landing_page_url, platform, language, tone_style):
|
||||
system_prompt = """You are an expert copywriter specializing in the FAB (Features-Advantages-Benefits) framework.
|
||||
Your expertise is in creating compelling, conversion-focused marketing copy that translates product features into meaningful customer benefits.
|
||||
Your copy is authentic, specific to the brand, and focused on driving measurable results."""
|
||||
|
||||
prompt = f"""Create 3 different marketing campaigns for {product_name}, which is a {product_description}.
|
||||
|
||||
TARGET AUDIENCE: {target_audience}
|
||||
UNIQUE SELLING POINT: {unique_selling_point}
|
||||
PLATFORM: {platform}
|
||||
LANGUAGE: {language}
|
||||
TONE & STYLE: {tone_style}
|
||||
|
||||
Use the FAB framework with these elements:
|
||||
- **Features**: {features}
|
||||
- **Advantages**: {advantages}
|
||||
- **Benefits**: {benefits}
|
||||
- **Call to Action**: {call_to_action}
|
||||
"""
|
||||
|
||||
if landing_page_url:
|
||||
prompt += f"\nInclude the landing page URL ({landing_page_url}) in your call to action."
|
||||
|
||||
prompt += """
|
||||
For each campaign:
|
||||
1. Start by highlighting the key features of the product or service
|
||||
2. Explain the advantages these features provide compared to alternatives
|
||||
3. Connect these advantages to specific benefits that customers will experience
|
||||
4. End with a strong call to action
|
||||
|
||||
Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers.
|
||||
Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires.
|
||||
"""
|
||||
|
||||
try:
|
||||
return llm_text_gen(prompt, system_prompt=system_prompt)
|
||||
except Exception as e:
|
||||
st.error(f"Error generating copy: {str(e)}")
|
||||
return None
|
||||
186
ToBeMigrated/ai_writers/ai_copywriter/oath_copywriter.py
Normal file
186
ToBeMigrated/ai_writers/ai_copywriter/oath_copywriter.py
Normal file
@@ -0,0 +1,186 @@
|
||||
import streamlit as st
|
||||
from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen
|
||||
from tenacity import retry, wait_random_exponential, stop_after_attempt
|
||||
|
||||
def input_section():
|
||||
st.markdown("""
|
||||
<div style='background-color: #f0f2f6; padding: 20px; border-radius: 10px; margin-bottom: 20px;'>
|
||||
<h2 style='color: #1E88E5;'>📋 OATH Copywriting Generator</h2>
|
||||
<p>Create compelling copy that addresses different audience mindsets using the OATH (Oblivious-Apathetic-Thinking-Hurting) framework.</p>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Educational content about OATH copywriting
|
||||
with st.expander("📚 What is OATH Copywriting?", expanded=False):
|
||||
st.markdown("""
|
||||
### Understanding the OATH Copywriting Framework
|
||||
|
||||
The OATH framework is a powerful copywriting approach that recognizes different audience mindsets:
|
||||
|
||||
- **Oblivious**: People who don't know they have a problem or need
|
||||
- **Apathetic**: People who know about the problem but don't care enough to act
|
||||
- **Thinking**: People who are actively considering solutions
|
||||
- **Hurting**: People who are experiencing pain and urgently need a solution
|
||||
|
||||
### Why OATH Copywriting Works
|
||||
|
||||
The OATH framework works because it:
|
||||
|
||||
- Addresses the full spectrum of audience awareness
|
||||
- Creates targeted messaging for each mindset
|
||||
- Increases conversion rates by meeting people where they are
|
||||
- Helps you craft the right message for the right audience
|
||||
- Allows for more personalized and effective marketing campaigns
|
||||
|
||||
### When to Use OATH Copywriting
|
||||
|
||||
The OATH framework is particularly effective for:
|
||||
|
||||
- New product launches
|
||||
- Educational content
|
||||
- Problem-solution marketing
|
||||
- Awareness campaigns
|
||||
- Multi-channel marketing strategies
|
||||
- Content that needs to address different audience segments
|
||||
""")
|
||||
|
||||
# Main input form
|
||||
with st.expander("✍️ Create Your OATH Copy", expanded=True):
|
||||
col1, col2 = st.columns([1, 1])
|
||||
|
||||
with col1:
|
||||
brand_name = st.text_input('**🏢 Brand/Company Name**',
|
||||
placeholder="e.g., Alwrity",
|
||||
help="Enter the name of your brand or company.")
|
||||
|
||||
target_audience = st.text_input('**👥 Target Audience**',
|
||||
placeholder="e.g., Small business owners, Tech professionals",
|
||||
help="Who is your ideal customer? Be specific about demographics and psychographics.")
|
||||
|
||||
oblivious = st.text_area('**🔍 Oblivious Audience**',
|
||||
placeholder="People who don't know they have this problem...",
|
||||
help="Describe the audience who doesn't know they have a problem or need your solution.")
|
||||
|
||||
apathetic = st.text_area('**😐 Apathetic Audience**',
|
||||
placeholder="People who know about the problem but don't care enough to act...",
|
||||
help="Describe the audience who knows about the problem but isn't motivated to solve it.")
|
||||
|
||||
with col2:
|
||||
description = st.text_input('**📝 Brand Description** (In 2-3 words)',
|
||||
placeholder="e.g., AI writing tools",
|
||||
help="Describe your product or service briefly.")
|
||||
|
||||
unique_selling_point = st.text_input('**💎 Unique Selling Point**',
|
||||
placeholder="e.g., 10x faster content creation",
|
||||
help="What makes your product/service different from competitors?")
|
||||
|
||||
thinking = st.text_area('**🤔 Thinking Audience**',
|
||||
placeholder="People who are actively considering solutions...",
|
||||
help="Describe the audience who is actively researching solutions to their problem.")
|
||||
|
||||
hurting = st.text_area('**😫 Hurting Audience**',
|
||||
placeholder="People who are experiencing pain and urgently need a solution...",
|
||||
help="Describe the audience who is experiencing significant pain and urgently needs a solution.")
|
||||
|
||||
tone_style = st.selectbox(
|
||||
'**🎭 Copy Tone & Style**',
|
||||
options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'],
|
||||
help="Select the tone and style for your copy."
|
||||
)
|
||||
|
||||
if st.button('**🚀 Generate OATH Copy**', type="primary"):
|
||||
if not brand_name or not description or not oblivious or not apathetic or not thinking or not hurting:
|
||||
st.error("⚠️ Please fill in all required fields (Brand Name, Description, and all audience segments)!")
|
||||
else:
|
||||
with st.spinner("✨ Crafting compelling OATH copy..."):
|
||||
oath_copy = generate_oath_copy(
|
||||
brand_name,
|
||||
description,
|
||||
oblivious,
|
||||
apathetic,
|
||||
thinking,
|
||||
hurting,
|
||||
target_audience,
|
||||
unique_selling_point,
|
||||
tone_style
|
||||
)
|
||||
|
||||
if oath_copy:
|
||||
st.markdown("""
|
||||
<div style='background-color: #e6f7ff; padding: 20px; border-radius: 10px; margin-top: 20px;'>
|
||||
<h3 style='color: #0066cc;'>📋 Your OATH Copy</h3>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Display the copy with a nice format
|
||||
st.markdown(oath_copy)
|
||||
|
||||
# Add copy button
|
||||
st.markdown("""
|
||||
<div style='margin-top: 20px;'>
|
||||
<button style='background-color: #4CAF50; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer;'>
|
||||
Copy to Clipboard
|
||||
</button>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Add tips for using the copy - using a container instead of an expander
|
||||
st.markdown("""
|
||||
<div style='background-color: #f9f9f9; padding: 15px; border-radius: 10px; margin-top: 20px;'>
|
||||
<h3 style='color: #333;'>💡 Tips for Using Your OATH Copy</h3>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
st.markdown("""
|
||||
### How to Use Your OATH Copy Effectively
|
||||
|
||||
1. **Target the right audience**: Use the appropriate OATH segment copy based on your target audience's current mindset
|
||||
|
||||
2. **Create a journey**: Consider how to move audiences from one mindset to another (e.g., from Oblivious to Thinking)
|
||||
|
||||
3. **Test different versions**: A/B test your copy to see which OATH segment resonates most with your audience
|
||||
|
||||
4. **Pair with visuals**: Combine your copy with images that reinforce the message for each audience segment
|
||||
|
||||
5. **Measure results**: Track engagement metrics to see how your OATH copy performs across different audience segments
|
||||
|
||||
6. **Refine over time**: Continuously improve your copy based on audience feedback and performance data
|
||||
""")
|
||||
else:
|
||||
st.error("💥 **Failed to generate OATH Copy. Please try again!**")
|
||||
|
||||
|
||||
@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))
|
||||
def generate_oath_copy(brand_name, description, oblivious, apathetic, thinking, hurting,
|
||||
target_audience, unique_selling_point, tone_style):
|
||||
system_prompt = """You are an expert copywriter specializing in the OATH (Oblivious-Apathetic-Thinking-Hurting) framework.
|
||||
Your expertise is in creating compelling, targeted marketing copy that addresses different audience mindsets and awareness levels.
|
||||
Your copy is authentic, specific to the brand, and focused on meeting audiences where they are in their journey."""
|
||||
|
||||
prompt = f"""Create 4 different marketing campaigns for {brand_name}, which is a {description}.
|
||||
|
||||
TARGET AUDIENCE: {target_audience}
|
||||
UNIQUE SELLING POINT: {unique_selling_point}
|
||||
TONE & STYLE: {tone_style}
|
||||
|
||||
Use the OATH framework with these audience segments:
|
||||
- **Oblivious**: {oblivious}
|
||||
- **Apathetic**: {apathetic}
|
||||
- **Thinking**: {thinking}
|
||||
- **Hurting**: {hurting}
|
||||
|
||||
For each campaign:
|
||||
1. Create a compelling headline that captures attention
|
||||
2. Write 2-3 paragraphs that address the specific audience mindset
|
||||
3. End with a strong call to action
|
||||
4. Explain how the copy is tailored to that specific audience mindset
|
||||
|
||||
Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers.
|
||||
Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires.
|
||||
"""
|
||||
|
||||
try:
|
||||
return llm_text_gen(prompt, system_prompt=system_prompt)
|
||||
except Exception as e:
|
||||
st.error(f"Error generating copy: {str(e)}")
|
||||
return None
|
||||
213
ToBeMigrated/ai_writers/ai_copywriter/pas_copywriter.py
Normal file
213
ToBeMigrated/ai_writers/ai_copywriter/pas_copywriter.py
Normal file
@@ -0,0 +1,213 @@
|
||||
import streamlit as st
|
||||
from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen
|
||||
from tenacity import retry, wait_random_exponential, stop_after_attempt
|
||||
|
||||
def input_section():
|
||||
st.markdown("""
|
||||
<div style='background-color: #f0f2f6; padding: 20px; border-radius: 10px; margin-bottom: 20px;'>
|
||||
<h2 style='color: #1E88E5;'>🎯 PAS Copywriting Generator</h2>
|
||||
<p>Create compelling copy that follows the PAS (Problem-Agitate-Solution) framework to drive conversions.</p>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Educational content about PAS copywriting
|
||||
with st.expander("📚 What is PAS Copywriting?", expanded=False):
|
||||
st.markdown("""
|
||||
### Understanding the PAS Copywriting Framework
|
||||
|
||||
PAS is an acronym for Problem-Agitate-Solution. It's a powerful copywriting framework that focuses on identifying and solving customer pain points:
|
||||
|
||||
- **Problem**: Identifying a specific problem or pain point that your target audience faces
|
||||
- **Agitate**: Amplifying the problem by highlighting its negative consequences and emotional impact
|
||||
- **Solution**: Presenting your product or service as the ideal solution to the problem
|
||||
|
||||
### Why PAS Copywriting Works
|
||||
|
||||
The PAS framework works because it:
|
||||
|
||||
- Addresses real customer pain points and needs
|
||||
- Creates emotional resonance by highlighting the consequences of inaction
|
||||
- Positions your product/service as the hero that solves the problem
|
||||
- Follows a natural problem-solving narrative that readers can relate to
|
||||
- Focuses on the customer's journey rather than just product features
|
||||
|
||||
### When to Use PAS Copywriting
|
||||
|
||||
The PAS framework is particularly effective for:
|
||||
|
||||
- Products or services that solve specific problems
|
||||
- Marketing to audiences with clear pain points
|
||||
- Content that needs to drive specific actions
|
||||
- Landing pages and sales pages
|
||||
- Email marketing campaigns
|
||||
- Direct response advertising
|
||||
""")
|
||||
|
||||
# Main input form
|
||||
with st.expander("✍️ Create Your PAS Copy", expanded=True):
|
||||
col1, col2 = st.columns([1, 1])
|
||||
|
||||
with col1:
|
||||
brand_name = st.text_input('**🏢 Brand/Company Name**',
|
||||
placeholder="e.g., Alwrity",
|
||||
help="Enter the name of your brand or company.")
|
||||
|
||||
target_audience = st.text_input('**👥 Target Audience**',
|
||||
placeholder="e.g., Small business owners, Tech professionals",
|
||||
help="Who is your ideal customer? Be specific about demographics and psychographics.")
|
||||
|
||||
problem = st.text_area('**❌ Problem**',
|
||||
placeholder="e.g., Struggling to create high-quality content that converts",
|
||||
help="Identify a specific problem or pain point that your target audience faces.")
|
||||
|
||||
agitate = st.text_area('**😫 Agitate**',
|
||||
placeholder="e.g., Without effective content, you're losing potential customers and revenue every day...",
|
||||
help="Amplify the problem by highlighting its negative consequences and emotional impact.")
|
||||
|
||||
with col2:
|
||||
description = st.text_input('**📝 Brand Description** (In 5-6 words)',
|
||||
placeholder="e.g., AI writing tools",
|
||||
help="Describe your product or service briefly.")
|
||||
|
||||
unique_selling_point = st.text_input('**💎 Unique Selling Point**',
|
||||
placeholder="e.g., 10x faster content creation",
|
||||
help="What makes your product/service different from competitors?")
|
||||
|
||||
solution = st.text_area('**✨ Solution**',
|
||||
placeholder="e.g., Our AI-powered platform creates high-converting content in minutes...",
|
||||
help="Present your product or service as the ideal solution to the problem.")
|
||||
|
||||
call_to_action = st.text_area('**🚀 Call to Action**',
|
||||
placeholder="e.g., Start creating converting content today with our 14-day free trial...",
|
||||
help="Prompt your audience to take action with a strong call to action.")
|
||||
|
||||
landing_page_url = st.text_input('**🌐 Landing Page URL** (Optional)',
|
||||
placeholder="e.g., https://alwrity.com",
|
||||
help="Provide a URL to include in your call to action.")
|
||||
|
||||
col1, col2 = st.columns([1, 1])
|
||||
with col1:
|
||||
platform = st.selectbox(
|
||||
'**📱 Content Platform**',
|
||||
options=['Social media copy', 'Email copy', 'Website copy', 'Ad copy', 'Product copy'],
|
||||
help="Select the platform where your copy will be used."
|
||||
)
|
||||
|
||||
with col2:
|
||||
language = st.selectbox(
|
||||
'**🌍 Language**',
|
||||
options=['English', 'Hindustani', 'Chinese', 'Hindi', 'Spanish'],
|
||||
help="Select the language for your copy."
|
||||
)
|
||||
|
||||
tone_style = st.selectbox(
|
||||
'**🎭 Copy Tone & Style**',
|
||||
options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'],
|
||||
help="Select the tone and style for your copy."
|
||||
)
|
||||
|
||||
if st.button('**🚀 Generate PAS Copy**', type="primary"):
|
||||
if not brand_name or not description or not problem or not agitate or not solution:
|
||||
st.error("⚠️ Please fill in all required fields (Brand Name, Description, Problem, Agitate, and Solution)!")
|
||||
else:
|
||||
with st.spinner("✨ Crafting compelling PAS copy..."):
|
||||
pas_copy = generate_pas_copy(
|
||||
brand_name,
|
||||
description,
|
||||
problem,
|
||||
agitate,
|
||||
solution,
|
||||
target_audience,
|
||||
unique_selling_point,
|
||||
call_to_action,
|
||||
landing_page_url,
|
||||
platform,
|
||||
language,
|
||||
tone_style
|
||||
)
|
||||
|
||||
if pas_copy:
|
||||
st.markdown("""
|
||||
<div style='background-color: #e6f7ff; padding: 20px; border-radius: 10px; margin-top: 20px;'>
|
||||
<h3 style='color: #0066cc;'>🎯 Your PAS Copy</h3>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Display the copy with a nice format
|
||||
st.markdown(pas_copy)
|
||||
|
||||
# Add copy button
|
||||
st.markdown("""
|
||||
<div style='margin-top: 20px;'>
|
||||
<button style='background-color: #4CAF50; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer;'>
|
||||
Copy to Clipboard
|
||||
</button>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Add tips for using the copy
|
||||
with st.expander("💡 Tips for Using Your PAS Copy", expanded=False):
|
||||
st.markdown("""
|
||||
### How to Use Your PAS Copy Effectively
|
||||
|
||||
1. **Follow the sequence**: The PAS framework creates a natural progression - make sure your copy maintains this flow
|
||||
|
||||
2. **Be specific about the problem**: The more specific and relatable the problem, the more effective your copy will be
|
||||
|
||||
3. **Balance agitation**: Don't over-agitate to the point of creating anxiety; find the right balance to motivate action
|
||||
|
||||
4. **Pair with visuals**: Combine your copy with images that reinforce each stage of the PAS journey
|
||||
|
||||
5. **Consider the context**: Adapt the copy based on where it will appear (landing page, email, social media, etc.)
|
||||
|
||||
6. **Measure results**: Track conversion metrics to see how your PAS copy performs
|
||||
|
||||
7. **Refine over time**: Continuously improve your copy based on audience feedback and performance data
|
||||
""")
|
||||
else:
|
||||
st.error("💥 **Failed to generate PAS Copy. Please try again!**")
|
||||
|
||||
|
||||
@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))
|
||||
def generate_pas_copy(brand_name, description, problem, agitate, solution,
|
||||
target_audience, unique_selling_point, call_to_action,
|
||||
landing_page_url, platform, language, tone_style):
|
||||
system_prompt = """You are an expert copywriter specializing in the PAS (Problem-Agitate-Solution) framework.
|
||||
Your expertise is in creating compelling, conversion-focused marketing copy that identifies customer pain points,
|
||||
amplifies their impact, and positions your product or service as the ideal solution.
|
||||
Your copy is authentic, specific to the brand, and focused on driving measurable results."""
|
||||
|
||||
prompt = f"""Create 3 different marketing campaigns for {brand_name}, which is a {description}.
|
||||
|
||||
TARGET AUDIENCE: {target_audience}
|
||||
UNIQUE SELLING POINT: {unique_selling_point}
|
||||
PLATFORM: {platform}
|
||||
LANGUAGE: {language}
|
||||
TONE & STYLE: {tone_style}
|
||||
|
||||
Use the PAS framework with these elements:
|
||||
- **Problem**: {problem}
|
||||
- **Agitate**: {agitate}
|
||||
- **Solution**: {solution}
|
||||
- **Call to Action**: {call_to_action}
|
||||
"""
|
||||
|
||||
if landing_page_url:
|
||||
prompt += f"\nInclude the landing page URL ({landing_page_url}) in your call to action."
|
||||
|
||||
prompt += """
|
||||
For each campaign:
|
||||
1. Start by identifying the specific problem or pain point
|
||||
2. Amplify the problem by highlighting its negative consequences and emotional impact
|
||||
3. Present your product or service as the ideal solution to the problem
|
||||
4. End with a strong call to action
|
||||
|
||||
Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers.
|
||||
Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires.
|
||||
"""
|
||||
|
||||
try:
|
||||
return llm_text_gen(prompt, system_prompt=system_prompt)
|
||||
except Exception as e:
|
||||
st.error(f"Error generating copy: {str(e)}")
|
||||
return None
|
||||
191
ToBeMigrated/ai_writers/ai_copywriter/quest_copywriter.py
Normal file
191
ToBeMigrated/ai_writers/ai_copywriter/quest_copywriter.py
Normal file
@@ -0,0 +1,191 @@
|
||||
import streamlit as st
|
||||
from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen
|
||||
from tenacity import retry, wait_random_exponential, stop_after_attempt
|
||||
|
||||
def title_and_description():
|
||||
st.markdown("""
|
||||
<div style='background-color: #f0f2f6; padding: 20px; border-radius: 10px; margin-bottom: 20px;'>
|
||||
<h2 style='color: #1E88E5;'>🔍 QUEST Copywriting Generator</h2>
|
||||
<p>Create compelling copy that guides your audience through a journey using the QUEST (Question-Unpack-Emphasize-Solution-Transform) framework.</p>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Educational content about QUEST copywriting
|
||||
with st.expander("📚 What is QUEST Copywriting?", expanded=False):
|
||||
st.markdown("""
|
||||
### Understanding the QUEST Copywriting Framework
|
||||
|
||||
QUEST is an acronym for Question-Unpack-Emphasize-Solution-Transform. It's a copywriting framework that focuses on guiding the audience through different stages:
|
||||
|
||||
- **Question**: Presenting a thought-provoking question to engage the audience
|
||||
- **Unpack**: Unpacking the question by elaborating on its implications and relevance
|
||||
- **Emphasize**: Emphasizing the importance or significance of the topic
|
||||
- **Solution**: Presenting your product or service as the solution to the question
|
||||
- **Transform**: Describing the transformation or improvement your solution offers
|
||||
|
||||
### Why QUEST Copywriting Works
|
||||
|
||||
The QUEST framework works because it:
|
||||
|
||||
- Creates a natural flow that guides readers through a journey
|
||||
- Engages readers by starting with a question they care about
|
||||
- Builds credibility by showing deep understanding of the problem
|
||||
- Demonstrates value by clearly connecting the solution to the problem
|
||||
- Inspires action by showing the transformation that's possible
|
||||
|
||||
### When to Use QUEST Copywriting
|
||||
|
||||
The QUEST framework is particularly effective for:
|
||||
|
||||
- Educational content and blog posts
|
||||
- Product launches and feature announcements
|
||||
- Problem-solution marketing
|
||||
- Thought leadership content
|
||||
- Content that needs to guide readers through a journey
|
||||
- Marketing materials that need to explain complex solutions
|
||||
""")
|
||||
|
||||
def input_section():
|
||||
# Main input form
|
||||
with st.expander("✍️ Create Your QUEST Copy", expanded=True):
|
||||
col1, col2 = st.columns([1, 1])
|
||||
|
||||
with col1:
|
||||
brand_name = st.text_input('**🏢 Brand/Company Name**',
|
||||
placeholder="e.g., Alwrity",
|
||||
help="Enter the name of your brand or company.")
|
||||
|
||||
target_audience = st.text_input('**👥 Target Audience**',
|
||||
placeholder="e.g., Small business owners, Tech professionals",
|
||||
help="Who is your ideal customer? Be specific about demographics and psychographics.")
|
||||
|
||||
question = st.text_area('**❓ Thought-Provoking Question**',
|
||||
placeholder="e.g., What if you could create content 10x faster without sacrificing quality?",
|
||||
help="Pose a question that resonates with your audience and highlights a problem they face.")
|
||||
|
||||
unpack = st.text_area('**📦 Unpack the Question**',
|
||||
placeholder="e.g., Content creation is time-consuming and often results in inconsistent quality...",
|
||||
help="Elaborate on the implications of the question and provide context that your audience can relate to.")
|
||||
|
||||
with col2:
|
||||
description = st.text_input('**📝 Brand Description** (In 2-3 words)',
|
||||
placeholder="e.g., AI writing tools",
|
||||
help="Describe your product or service briefly.")
|
||||
|
||||
unique_selling_point = st.text_input('**💎 Unique Selling Point**',
|
||||
placeholder="e.g., 10x faster content creation",
|
||||
help="What makes your product/service different from competitors?")
|
||||
|
||||
emphasize = st.text_area('**💪 Emphasize Importance**',
|
||||
placeholder="e.g., In today's fast-paced digital world, efficient content creation is essential for business growth...",
|
||||
help="Highlight the relevance and impact of addressing this problem.")
|
||||
|
||||
solution = st.text_area('**🔧 Present Your Solution**',
|
||||
placeholder="e.g., Our AI-powered writing assistant helps you create high-quality content in a fraction of the time...",
|
||||
help="Introduce your product or service as the solution to the question.")
|
||||
|
||||
transform = st.text_area('**✨ Describe the Transformation**',
|
||||
placeholder="e.g., Imagine having more time to focus on strategy while maintaining consistent, high-quality content...",
|
||||
help="Describe the transformation or improvement your solution offers to your audience.")
|
||||
|
||||
tone_style = st.selectbox(
|
||||
'**🎭 Copy Tone & Style**',
|
||||
options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'],
|
||||
help="Select the tone and style for your copy."
|
||||
)
|
||||
|
||||
if st.button('**🚀 Generate QUEST Copy**', type="primary"):
|
||||
if not brand_name or not description or not question or not unpack or not emphasize or not solution or not transform:
|
||||
st.error("⚠️ Please fill in all required fields (Brand Name, Description, and all QUEST elements)!")
|
||||
else:
|
||||
with st.spinner("✨ Crafting compelling QUEST copy..."):
|
||||
quest_copy = generate_quest_copy(
|
||||
brand_name,
|
||||
description,
|
||||
question,
|
||||
unpack,
|
||||
emphasize,
|
||||
solution,
|
||||
transform,
|
||||
target_audience,
|
||||
unique_selling_point,
|
||||
tone_style
|
||||
)
|
||||
|
||||
if quest_copy:
|
||||
st.markdown("""
|
||||
<div style='background-color: #e6f7ff; padding: 20px; border-radius: 10px; margin-top: 20px;'>
|
||||
<h3 style='color: #0066cc;'>🔍 Your QUEST Copy</h3>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Display the copy with a nice format
|
||||
st.markdown(quest_copy)
|
||||
|
||||
# Add copy button
|
||||
st.markdown("""
|
||||
<div style='margin-top: 20px;'>
|
||||
<button style='background-color: #4CAF50; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer;'>
|
||||
Copy to Clipboard
|
||||
</button>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Add tips for using the copy
|
||||
with st.expander("💡 Tips for Using Your QUEST Copy", expanded=False):
|
||||
st.markdown("""
|
||||
### How to Use Your QUEST Copy Effectively
|
||||
|
||||
1. **Follow the journey**: The QUEST framework creates a natural flow - make sure your copy maintains this progression
|
||||
|
||||
2. **Test different questions**: A/B test different opening questions to see which resonates most with your audience
|
||||
|
||||
3. **Pair with visuals**: Combine your copy with images that reinforce each stage of the QUEST journey
|
||||
|
||||
4. **Consider the context**: Adapt the copy based on where it will appear (blog post, landing page, email, etc.)
|
||||
|
||||
5. **Measure results**: Track engagement metrics to see how your QUEST copy performs
|
||||
|
||||
6. **Refine over time**: Continuously improve your copy based on audience feedback and performance data
|
||||
""")
|
||||
else:
|
||||
st.error("💥 **Failed to generate QUEST Copy. Please try again!**")
|
||||
|
||||
|
||||
@retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6))
|
||||
def generate_quest_copy(brand_name, description, question, unpack, emphasize, solution, transform,
|
||||
target_audience, unique_selling_point, tone_style):
|
||||
system_prompt = """You are an expert copywriter specializing in the QUEST (Question-Unpack-Emphasize-Solution-Transform) framework.
|
||||
Your expertise is in creating compelling, narrative-driven marketing copy that guides readers through a journey.
|
||||
Your copy is authentic, specific to the brand, and focused on connecting with the audience's needs and desires."""
|
||||
|
||||
prompt = f"""Create 3 different marketing campaigns for {brand_name}, which is a {description}.
|
||||
|
||||
TARGET AUDIENCE: {target_audience}
|
||||
UNIQUE SELLING POINT: {unique_selling_point}
|
||||
TONE & STYLE: {tone_style}
|
||||
|
||||
Use the QUEST framework with these elements:
|
||||
- **Question**: {question}
|
||||
- **Unpack**: {unpack}
|
||||
- **Emphasize**: {emphasize}
|
||||
- **Solution**: {solution}
|
||||
- **Transform**: {transform}
|
||||
|
||||
For each campaign:
|
||||
1. Start with the thought-provoking question to engage the audience
|
||||
2. Unpack the question by elaborating on its implications
|
||||
3. Emphasize the importance of addressing this issue
|
||||
4. Present your solution clearly and convincingly
|
||||
5. Describe the transformation that your solution offers
|
||||
6. End with a strong call to action
|
||||
|
||||
Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers.
|
||||
Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires.
|
||||
"""
|
||||
|
||||
try:
|
||||
return llm_text_gen(prompt, system_prompt=system_prompt)
|
||||
except Exception as e:
|
||||
st.error(f"Error generating copy: {str(e)}")
|
||||
return None
|
||||
182
ToBeMigrated/ai_writers/ai_copywriter/star_copywriter.py
Normal file
182
ToBeMigrated/ai_writers/ai_copywriter/star_copywriter.py
Normal file
@@ -0,0 +1,182 @@
|
||||
import streamlit as st
|
||||
from lib.gpt_providers.text_generation.main_text_generation import llm_text_gen
|
||||
|
||||
def input_section():
|
||||
st.markdown("""
|
||||
<div style='background-color: #f0f2f6; padding: 20px; border-radius: 10px; margin-bottom: 20px;'>
|
||||
<h2 style='color: #1E88E5;'>⭐ STAR Copywriting Generator</h2>
|
||||
<p>Create compelling marketing copy using the proven STAR (Situation-Task-Action-Result) framework.</p>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Educational content about STAR copywriting
|
||||
with st.expander("📚 What is STAR Copywriting?", expanded=False):
|
||||
st.markdown("""
|
||||
### Understanding the STAR Copywriting Framework
|
||||
|
||||
The STAR framework is a powerful storytelling structure that creates compelling narratives:
|
||||
|
||||
- **Situation**: Set the context and background for the problem or need
|
||||
- **Task**: Describe the specific challenge or objective that needs to be addressed
|
||||
- **Action**: Explain the specific actions taken to address the challenge
|
||||
- **Result**: Highlight the positive outcomes and benefits achieved
|
||||
|
||||
### Why STAR Copywriting Works
|
||||
|
||||
The STAR framework works because it:
|
||||
|
||||
- Creates a complete narrative arc that engages readers
|
||||
- Demonstrates problem-solving capabilities
|
||||
- Shows concrete results and benefits
|
||||
- Builds credibility through specific examples
|
||||
- Makes abstract benefits tangible through storytelling
|
||||
|
||||
### When to Use STAR Copywriting
|
||||
|
||||
The STAR framework is particularly effective for:
|
||||
|
||||
- Case studies and success stories
|
||||
- Product or service demonstrations
|
||||
- Customer testimonials
|
||||
- Company achievements and milestones
|
||||
- Problem-solution marketing
|
||||
- Portfolio showcases
|
||||
""")
|
||||
|
||||
# Main input form
|
||||
with st.expander("✍️ Create Your STAR Copy", expanded=True):
|
||||
col1, col2 = st.columns([1, 1])
|
||||
|
||||
with col1:
|
||||
brand_name = st.text_input('**🏢 Brand/Company Name**',
|
||||
placeholder="e.g., Alwrity",
|
||||
help="Enter the name of your brand or company.")
|
||||
|
||||
target_audience = st.text_input('**👥 Target Audience**',
|
||||
placeholder="e.g., Small business owners, Tech professionals",
|
||||
help="Who is your ideal customer? Be specific about demographics and psychographics.")
|
||||
|
||||
situation = st.text_area('**🌍 Situation (Context)**',
|
||||
placeholder="In a busy city, Late Delivery, Unsafe Activities, Unprofessional Service..",
|
||||
help="Describe the background context or problem that needs to be addressed.")
|
||||
|
||||
action = st.text_area('**⚡ Action (Solution)**',
|
||||
placeholder="New strategy, launched campaign, better service, New product...",
|
||||
help="Describe the specific actions taken to address the challenge or objective.")
|
||||
|
||||
with col2:
|
||||
description = st.text_input('**📝 Brand Description** (In 2-3 words)',
|
||||
placeholder="e.g., AI writing tools",
|
||||
help="Describe your product or service briefly.")
|
||||
|
||||
unique_selling_point = st.text_input('**💎 Unique Selling Point**',
|
||||
placeholder="e.g., 10x faster content creation",
|
||||
help="What makes your product/service different from competitors?")
|
||||
|
||||
task = st.text_area('**🎯 Task (Challenge)**',
|
||||
placeholder="Increase website traffic by 30%, improve customer satisfaction, Safe Travels...",
|
||||
help="Describe the specific challenge or objective that needs to be addressed.")
|
||||
|
||||
result = st.text_area('**✨ Result (Outcome)**',
|
||||
placeholder="Improved customer engagement, sales revenue, Happy customers, Improved Service X...",
|
||||
help="Highlight the positive outcomes and benefits achieved from the actions taken.")
|
||||
|
||||
tone_style = st.selectbox(
|
||||
'**🎭 Copy Tone & Style**',
|
||||
options=['Professional', 'Conversational', 'Humorous', 'Authoritative', 'Empathetic', 'Aspirational'],
|
||||
help="Select the tone and style for your copy."
|
||||
)
|
||||
|
||||
if st.button('**🚀 Generate STAR Copy**', type="primary"):
|
||||
if not brand_name or not description or not situation or not task or not action or not result:
|
||||
st.error("⚠️ Please fill in all required fields (Brand Name, Description, Situation, Task, Action, and Result)!")
|
||||
else:
|
||||
with st.spinner("✨ Crafting compelling STAR copy..."):
|
||||
star_copy = generate_star_copy(
|
||||
brand_name,
|
||||
description,
|
||||
situation,
|
||||
task,
|
||||
action,
|
||||
result,
|
||||
target_audience,
|
||||
unique_selling_point,
|
||||
tone_style
|
||||
)
|
||||
|
||||
if star_copy:
|
||||
st.markdown("""
|
||||
<div style='background-color: #e6f7ff; padding: 20px; border-radius: 10px; margin-top: 20px;'>
|
||||
<h3 style='color: #0066cc;'>⭐ Your STAR Copy</h3>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Display the copy with a nice format
|
||||
st.markdown(star_copy)
|
||||
|
||||
# Add copy button
|
||||
st.markdown("""
|
||||
<div style='margin-top: 20px;'>
|
||||
<button style='background-color: #4CAF50; color: white; padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer;'>
|
||||
Copy to Clipboard
|
||||
</button>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
# Add tips for using the copy - using a container instead of an expander
|
||||
st.markdown("""
|
||||
<div style='background-color: #f9f9f9; padding: 15px; border-radius: 10px; margin-top: 20px;'>
|
||||
<h3 style='color: #333;'>💡 Tips for Using Your STAR Copy</h3>
|
||||
</div>
|
||||
""", unsafe_allow_html=True)
|
||||
|
||||
st.markdown("""
|
||||
### How to Use Your STAR Copy Effectively
|
||||
|
||||
1. **Test different versions**: A/B test your copy to see which version resonates most with your audience
|
||||
|
||||
2. **Pair with visuals**: Combine your copy with images that illustrate each stage of the STAR framework
|
||||
|
||||
3. **Consider the platform**: Adapt your copy based on where it will appear (social media, email, website, etc.)
|
||||
|
||||
4. **Measure results**: Track engagement metrics to see how your STAR copy performs
|
||||
|
||||
5. **Refine over time**: Continuously improve your copy based on audience feedback and performance data
|
||||
""")
|
||||
else:
|
||||
st.error("💥 **Failed to generate STAR Copy. Please try again!**")
|
||||
|
||||
|
||||
def generate_star_copy(brand_name, description, situation, task, action, result, target_audience,
|
||||
unique_selling_point, tone_style):
|
||||
system_prompt = """You are an expert copywriter specializing in the STAR (Situation-Task-Action-Result) framework.
|
||||
Your expertise is in creating compelling, narrative-driven marketing copy that tells a complete story from problem to solution.
|
||||
Your copy is authentic, specific to the brand, and focused on demonstrating concrete results and benefits."""
|
||||
|
||||
prompt = f"""Create 3 different marketing campaigns for {brand_name}, which is a {description}.
|
||||
|
||||
TARGET AUDIENCE: {target_audience}
|
||||
UNIQUE SELLING POINT: {unique_selling_point}
|
||||
TONE & STYLE: {tone_style}
|
||||
|
||||
Use the STAR framework with these elements:
|
||||
- **Situation**: {situation}
|
||||
- **Task**: {task}
|
||||
- **Action**: {action}
|
||||
- **Result**: {result}
|
||||
|
||||
For each campaign:
|
||||
1. Create a compelling headline that captures attention
|
||||
2. Write 2-3 paragraphs that follow the STAR framework
|
||||
3. End with a strong call to action
|
||||
4. Explain how each element of the STAR framework is used in the copy
|
||||
|
||||
Format each campaign clearly with "CAMPAIGN 1:", "CAMPAIGN 2:", etc. as headers.
|
||||
Make the copy authentic, specific to the brand, and focused on the target audience's needs and desires.
|
||||
"""
|
||||
|
||||
try:
|
||||
return llm_text_gen(prompt, system_prompt=system_prompt)
|
||||
except Exception as e:
|
||||
st.error(f"Error generating copy: {str(e)}")
|
||||
return None
|
||||
Reference in New Issue
Block a user