etheroi / app.py
Jeremy Live
borro linea que no sirve
bf0eab5
import os
import time
import logging
import gradio as gr
import requests
import threading
from dotenv import load_dotenv
from typing import Dict, Optional
# Load environment variables from .env file
load_dotenv()
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
# Modal setup with proper secret handling
MODAL_AVAILABLE = False
generate_content = None
# Define the app name - must match your Modal app name in modal_backend.py
MODAL_APP_NAME = "content-creation-agent"
try:
import modal
from modal.exception import AuthError
from modal.config import config
logger.info(f"Modal version: {modal.__version__}")
# Check for required tokens in environment
hf_token = os.environ.get("HF_TOKEN")
modal_token_id = os.environ.get("MODAL_TOKEN_ID")
modal_token_secret = os.environ.get("MODAL_TOKEN_SECRET")
if not hf_token:
logger.warning("⚠️ HF_TOKEN not found in environment variables. Running in local mode.")
logger.info("ℹ️ To enable AI features, set HF_TOKEN in your environment variables")
elif not (modal_token_id and modal_token_secret):
logger.warning("⚠️ Modal token ID or secret not found. Running in local mode.")
logger.info("ℹ️ To enable Modal features, set both MODAL_TOKEN_ID and MODAL_TOKEN_SECRET")
else:
try:
logger.info("πŸ” Initializing Modal client...")
# Initialize the client
try:
# Initialize Modal - no need to create a client instance directly
# The Modal client is automatically configured from environment variables
# or the config file created by 'modal token new'
# Create a secret with the Hugging Face token
hf_secret = modal.Secret.from_dict({"HUGGING_FACE_HUB_TOKEN": hf_token})
# Store the secret for later use
modal.Secret.from_dict({"HUGGING_FACE_HUB_TOKEN": hf_token})
logger.info("βœ… Successfully initialized Modal client")
# No need to list functions, we'll try to look them up directly
logger.info("πŸ” Setting up Modal function lookups...")
# Initialize functions dictionary
functions = {
'generate_content': None,
# 'generate_image': None,
'generate_content_with_llm': None
}
# Ensure app_name is defined
if 'app_name' not in locals():
app_name = MODAL_APP_NAME
logger.info(f"Using app name: {app_name}")
# Try to find each function directly
for func_name in ['generate_content', 'generate_image', 'generate_content_with_llm']:
try:
# First try with app_name
try:
functions[func_name] = modal.Function.from_name(app_name, func_name)
logger.info(f"βœ… Found {func_name} function: {app_name}::{func_name}")
except Exception:
# Fallback to just function name
functions[func_name] = modal.Function.from_name(func_name)
logger.info(f"βœ… Found {func_name} function: {func_name}")
except Exception as e:
logger.warning(f"Could not find {func_name} function: {str(e)}")
# Check if we found all required functions
missing_funcs = [name for name, func in functions.items() if func is None and name != 'generate_content_with_llm']
if missing_funcs:
logger.warning(f"⚠️ Could not find the following functions: {', '.join(missing_funcs)}")
if not all([functions['generate_content'], functions['generate_image']]):
raise Exception("Could not find required generation functions")
# Assign the functions to variables
generate_content = functions['generate_content']
generate_image = functions['generate_image']
generate_content_with_llm = functions['generate_content_with_llm']
MODAL_AVAILABLE = True
logger.info("πŸš€ Successfully connected to Modal AI service")
# Skip the content generation test to improve startup time
logger.info("⏭️ Skipping content generation test for faster startup")
MODAL_AVAILABLE = True
except Exception as e:
logger.error(f"❌ Failed to initialize Modal functions: {str(e)}")
logger.info(f"ℹ️ Make sure your app '{MODAL_APP_NAME}' is deployed and contains the required functions")
logger.info("ℹ️ Make sure you're logged in with 'modal token new' if needed")
MODAL_AVAILABLE = False
except AuthError as e:
logger.error(f"❌ Authentication failed: {str(e)}")
logger.info("ℹ️ Please check your MODAL_TOKEN_ID and MODAL_TOKEN_SECRET")
logger.info("ℹ️ Generate a new token with: modal token new")
MODAL_AVAILABLE = False
except Exception as e:
logger.error(f"❌ Error initializing Modal client: {str(e)}")
MODAL_AVAILABLE = False
except ImportError:
logger.warning("⚠️ Modal package not installed. Running in local mode.")
logger.info("ℹ️ Install with: pip install modal")
MODAL_AVAILABLE = False
def generate_fallback_content(business_type, target_audience, content_goal, brand_name, key_message):
"""High-quality content generation for entrepreneurs and influencers"""
# Determine content tone based on goal
tone = "professional"
if any(word in content_goal.lower() for word in ['inspire', 'motivate', 'empower']):
tone = "inspirational"
elif any(word in content_goal.lower() for word in ['educate', 'teach', 'explain', 'inform']):
tone = "educational"
elif any(word in content_goal.lower() for word in ['promote', 'sell', 'offer', 'deal']):
tone = "persuasive"
# Extract key themes from inputs
theme_words = []
content_lower = f"{business_type} {target_audience} {content_goal} {key_message}".lower()
# Business/Influencer specific themes
if any(word in content_lower for word in ['startup', 'business', 'entrepreneur']):
theme_words.append('entrepreneurship')
if any(word in content_lower for word in ['social', 'media', 'influencer']):
theme_words.append('social media')
if any(word in content_lower for word in ['product', 'service', 'offer']):
theme_words.append('products')
if any(word in content_lower for word in ['growth', 'scale', 'expand']):
theme_words.append('growth')
if any(word in content_lower for word in ['success', 'achieve', 'goal']):
theme_words.append('success')
themes_text = ', '.join(theme_words[:3]) if theme_words else 'business growth'
# Content type detection
content_type = 'post'
if any(word in content_goal.lower() for word in ['video', 'reel', 'tiktok']):
content_type = 'video'
elif any(word in content_goal.lower() for word in ['blog', 'article', 'thread']):
content_type = 'article'
elif any(word in content_goal.lower() for word in ['story', 'update', 'status']):
content_type = 'story'
# Premium hashtag generation for business/influencer content
base_hashtags = {
'linkedin': ['entrepreneur', 'business', 'success', 'marketing', 'startup', 'leadership', 'networking', 'career', 'innovation', 'motivation'],
'instagram': ['entrepreneurlife', 'businesstips', 'digitalmarketing', 'startup', 'successmindset', 'businessowner', 'hustle', 'entrepreneurmindset', 'businessgrowth', 'smallbusiness'],
'tiktok': ['businesstok', 'entrepreneurtips', 'startupstory', 'businesstips', 'marketingtips', 'businesstiktok', 'entrepreneurlife', 'smallbusinesscheck', 'businesstok', 'successmindset'],
'twitter': ['entrepreneur', 'startup', 'business', 'marketing', 'success', 'leadership', 'motivation', 'hustle', 'mindset', 'growth'],
'facebook': ['entrepreneur', 'smallbusiness', 'marketing', 'businessowner', 'startup', 'success', 'leadership', 'networking', 'career', 'innovation']
}
# Add theme-based hashtags
for platform in base_hashtags:
for theme in theme_words[:2]: # Add top 2 themes
base_hashtags[platform].append(theme.replace(' ', ''))
# Format hashtags with proper limits
hashtags = {}
limits = {'linkedin': 5, 'instagram': 15, 'tiktok': 10, 'twitter': 5, 'facebook': 5}
for platform, tags in base_hashtags.items():
limit = limits.get(platform, 10)
formatted_tags = ' '.join(f'#{tag}' for tag in tags[:limit])
hashtags[platform] = formatted_tags
brand_display = brand_name if brand_name.strip() else "Your Brand"
# Content for different platforms
return {
'linkedin': f"""πŸš€ Excited to share some {tone} insights about {business_type}!
{key_message}
As {brand_display}, we're passionate about helping {target_audience} achieve their goals through {themes_text}.
πŸ’‘ What's your biggest challenge with {business_type}? Let's discuss in the comments!
{hashtags['linkedin']}""",
'instagram': f"""✨ {content_goal.capitalize()} for {target_audience} ✨
{key_message}
At {brand_display}, we believe in {themes_text} to drive real results. πŸ’ͺ
Swipe through for more insights! πŸ‘‰
πŸ’¬ What's your biggest takeaway? Comment below!
πŸ”” Follow @{brand_display.lower().replace(' ', '')} for more {business_type} tips
{hashtags['instagram']}""",
'tiktok': f"""πŸš€ {content_goal.upper()} ALERT! πŸš€
{key_message}
As a {business_type}, here's what we've learned about {themes_text}:
1️⃣ [Key Point 1]
2️⃣ [Key Point 2]
3️⃣ [Key Point 3]
What would you add? πŸ‘‡ #shorts
{hashtags['tiktok']}""",
'twitter': f"""{content_goal.capitalize()} for {target_audience}:
{key_message}
At @{brand_display}, we're all about {themes_text}.
What's your experience with {business_type}? Let's chat! πŸ‘‡
{hashtags['twitter']}""",
'facebook': f"""🌟 {content_goal.upper()} ALERT! 🌟
{key_message}
As {brand_display}, we're excited to share our latest insights on {business_type} and how it can help {target_audience} succeed through {themes_text}.
πŸ’‘ What's your biggest challenge in this space? Let's discuss in the comments!
{hashtags['facebook']}"""
}
def generate_all_content(business_type, target_audience, content_goal, brand_name, key_message, use_modal, model_name="mistral"):
"""Generate content for all platforms using Modal AI or local service
Args:
business_type: Type of business or content focus
target_audience: Description of the target audience
content_goal: The goal of the content
brand_name: Name of the brand
key_message: Main message to communicate
use_modal: Whether to use Modal AI or local templates
model_name: Name of the model to use
"""
if not all([business_type.strip(), target_audience.strip(), content_goal.strip(), key_message.strip()]):
return [""] * 5 + ["❌ Please fill in all required fields"]
start_time = time.time()
try:
if use_modal and MODAL_AVAILABLE and generate_content is not None:
try:
# Try to use Modal if available
selected_model = model_selector_combined.value if hasattr(model_selector_combined, 'value') else model_name
result = generate_content.remote(
business_type=business_type,
target_audience=target_audience,
content_goal=content_goal,
brand_name=brand_name,
key_message=key_message,
model_name=selected_model
)
if isinstance(result, dict) and result.get('status') == 'success':
content = result.get('content', {})
status_msg = f"βœ… {result.get('message', 'Content generated')} in {time.time() - start_time:.2f}s"
else:
raise ValueError("Unexpected response format from Modal AI")
except Exception as e:
logger.error(f"Error generating content with Modal: {str(e)}")
# Fall back to local MCP service
result = generate_with_mcp(business_type, target_audience, content_goal, brand_name, key_message)
if result.get('success'):
content = result.get('content', {})
status_msg = f"⚠️ Using local generation (Modal failed)"
else:
content = generate_fallback_content(business_type, target_audience, content_goal, brand_name, key_message)
status_msg = f"⚠️ Using fallback templates"
else:
# Use local MCP service
result = generate_with_mcp(business_type, target_audience, content_goal, brand_name, key_message)
if result.get('success'):
content = result.get('content', {})
status_msg = f"βœ… Generated with local service"
else:
content = generate_fallback_content(business_type, target_audience, content_goal, brand_name, key_message)
status_msg = f"βœ… Generated with fallback templates"
except Exception as e:
logger.error(f"Unexpected error: {str(e)}")
content = generate_fallback_content(business_type, target_audience, content_goal, brand_name, key_message)
status_msg = f"❌ Error occurred, using fallback templates"
# Prepare the outputs for all platforms
return [
content.get('linkedin', "Could not generate LinkedIn content"),
content.get('instagram', "Could not generate Instagram content"),
content.get('tiktok', "Could not generate TikTok content"),
content.get('twitter', "Could not generate Twitter content"),
content.get('facebook', "Could not generate Facebook content"),
status_msg
]
# MCP Service (Local Implementation for Hugging Face Spaces)
class MCPService:
def __init__(self):
self.is_available = True
logger.info("MCP Service initialized in Hugging Face Spaces mode")
def is_running(self) -> bool:
"""Check if MCP service is available"""
return self.is_available
def generate_content(self, **kwargs):
"""Generate content using local implementation"""
try:
# This is a simplified version of the content generation
# that would normally be handled by the MCP server
business_type = kwargs.get('business_type', '')
target_audience = kwargs.get('target_audience', '')
content_goal = kwargs.get('content_goal', '')
brand_name = kwargs.get('brand_name', 'Your Brand')
key_message = kwargs.get('key_message', '')
# Generate content for different platforms
content = {
'linkedin': f"πŸš€ {business_type} for {target_audience}\n\n{key_message}\n\n#{business_type.replace(' ', '')} #{target_audience.replace(' ', '')} #ContentCreation",
'instagram': f"✨ {content_goal}\n\n{key_message}\n\n#{business_type.replace(' ', '')} #{target_audience.replace(' ', '')} #ContentCreation",
'twitter': f"{key_message}\n\n#{business_type.replace(' ', '')} #{target_audience.replace(' ', '')} #ContentCreation",
'tiktok': f"{content_goal} πŸ‘€\n\n{key_message}\n\n#{business_type.replace(' ', '')} #{target_audience.replace(' ', '')} #ContentCreation",
'facebook': f"{business_type} - {content_goal}\n\n{key_message}\n\n#{business_type.replace(' ', '')} #{target_audience.replace(' ', '')} #ContentCreation"
}
return {
'success': True,
'content': content,
'message': 'Content generated locally in Hugging Face Space'
}
except Exception as e:
logger.error(f"Error in local content generation: {str(e)}")
return {
'success': False,
'content': {},
'message': f'Error generating content: {str(e)}'
}
# Initialize MCP service
mcp_service = MCPService()
# Create Gradio interface
with gr.Blocks(theme=gr.themes.Soft(), title="πŸš€ Content Creator Pro") as demo:
gr.Markdown(f"""
# πŸš€ ContentCreator Pro: Your AI-Powered Marketing Assistant
Transform your social media presence with AI-generated, platform-perfect content in seconds! Designed for entrepreneurs, marketers, and content creators who want to save time while maximizing engagement.
**Running in Hugging Face Spaces mode** 🌐
""")
with gr.Row():
with gr.Column(scale=1):
gr.Markdown("### ✨ Why Choose ContentCreator Pro?")
gr.Markdown("""
- πŸ€– **AI-Powered Intelligence**: Generate high-quality, engaging content using advanced AI (Modal integration required)
- 🌐 **Multi-Platform Mastery**: Get perfectly optimized content for LinkedIn, Instagram, TikTok, X (Twitter), and Facebook
- πŸ” **Smart Hashtag Engine**: Automatically generates relevant hashtags tailored to your industry and marketing objectives
- 🎨 **Professional Templates**: Choose from various content types including promotions, announcements, and educational posts
- ⚑ **Lightning Fast**: Create a week's worth of content in minutes, not hours
- 🎯 **Goal-Oriented**: Content strategies designed to increase engagement, followers, and conversions
""")
with gr.Column(scale=1):
gr.Markdown("### πŸ’‘ Pro Tips for Maximum Impact")
gr.Markdown("""
- **🎯 Know Your Audience:** Be specific about who you're targeting (e.g., "Tech startup founders in Latin America" vs. "Business people")
- **✨ Define Clear Objectives:** What's your goal? (Brand awareness, lead generation, community engagement, product launch)
- **πŸ’Ž Craft a Strong CTA:** Tell your audience exactly what to do next (Comment, DM, Visit link, etc.)
- **πŸ“Š Test & Optimize:** Try different content variations to see what resonates best with your audience
- **πŸ” Stay Consistent:** Regular posting with a consistent voice and style builds brand recognition
""")
{"" if MODAL_AVAILABLE else "**To enable AI Generation:** Add your Modal token to the HuggingFace Space environment variables"}
with gr.Row():
with gr.Column():
business_type = gr.Textbox(
label="🏒 Business/Content Type",
placeholder="e.g., Digital Marketing Agency, E-commerce Store, Personal Brand",
info="What type of business or content do you create?"
)
target_audience = gr.Textbox(
label="🎯 Target Audience",
placeholder="e.g., Small business owners, Young professionals, Tech enthusiasts",
info="Who is your ideal customer or follower?"
)
content_goal = gr.Textbox(
label="🎯 Content Goal",
placeholder="e.g., Promote new service, Share industry insights, Engage followers",
info="What's the purpose of this content?"
)
brand_name = gr.Textbox(
label="🏷️ Brand/Personal Name",
placeholder="Your brand or personal name",
info="Leave blank to use generic terms"
)
key_message = gr.Textbox(
label="πŸ’‘ Key Message",
lines=3,
placeholder="Main point or call-to-action for your content...",
info="What's the core message you want to communicate?"
)
# Modal toggle
modal_toggle = gr.Radio(
choices=[
("πŸ€– AI Generation (Modal)", True),
("πŸ“ Local Templates", False)
],
value=MODAL_AVAILABLE,
label="Generation Method",
info="Choose between AI-powered generation or local templates"
)
# Model selection (only visible when AI generation is selected)
with gr.Group(visible=MODAL_AVAILABLE) as model_group:
with gr.Tabs() as model_tabs:
with gr.TabItem("πŸš€ Fast Models"):
gr.Markdown("### ⚑ Optimized for Speed")
model_selector = gr.Radio(
choices=[
("πŸ‡ΊπŸ‡Έ Mistral 7B - Fast & Balanced (Recommended)", "mistral"),
("πŸ‡ΊπŸ‡Έ Phi-3 Mini - Ultra Fast (4K context)", "phi3"),
("🌍 Gemma 2B - Lightweight & Quick", "gemma2b")
],
value="mistral",
label="πŸ€– Select AI Model",
info="Fast models for quick generation with good quality"
)
with gr.TabItem("🎯 Advanced Models"):
gr.Markdown("### πŸ† Higher Quality (Slower)")
model_selector_advanced = gr.Radio(
choices=[
# English Models
("πŸ‡ΊπŸ‡Έ Llama 2 7B - Balanced English", "llama2-7b-en"),
("πŸ‡ΊπŸ‡Έ Llama 2 13B - High Quality English", "llama2-13b-en"),
# Spanish Models
("πŸ‡ͺπŸ‡Έ Lince Zero - Optimized for Spanish", "lince"),
("πŸ‡ͺπŸ‡Έ Llama 3 8B - High Quality Spanish", "llama3-8b-es"),
# Multilingual
("🌍 BLOOM 7B - Multilingual (ES/EN)", "bloom")
],
value="llama2-7b-en",
label="πŸ€– Select Advanced Model",
info="Higher quality models that take longer to generate"
)
# Combine both selectors for the generation function
model_selector_combined = gr.Textbox(
value="mistral",
visible=False,
label="Selected Model"
)
# Update the combined selector when either radio button changes
def update_combined_model(fast_model, advanced_model, active_tab):
return advanced_model if active_tab == 1 else fast_model
model_tabs.select(
fn=lambda tab: tab,
inputs=model_tabs,
outputs=gr.Textbox(visible=False),
show_progress=False
).then(
fn=update_combined_model,
inputs=[model_selector, model_selector_advanced, model_tabs],
outputs=model_selector_combined
)
model_selector.change(
fn=lambda x: x,
inputs=model_selector,
outputs=model_selector_combined,
show_progress=False
)
model_selector_advanced.change(
fn=lambda x: x,
inputs=model_selector_advanced,
outputs=model_selector_combined,
show_progress=False
)
# Image generation toggle (only visible when AI generation is selected)
# with gr.Group(visible=MODAL_AVAILABLE) as image_group:
# generate_image_toggle = gr.Checkbox(
# label="πŸ–ΌοΈ Generate AI Image",
# value=False,
# info="Check to generate an AI image based on your content"
# )
run_button = gr.Button("πŸš€ Generate Content", variant="primary", size="lg")
if not MODAL_AVAILABLE:
gr.Markdown("""
⚠️ **AI Models Disabled**: You need to set up your Modal credentials to use AI generation.
To enable AI models:
1. Sign up at [Modal](https://modal.com/)
2. Get your API token
3. Set the following environment variables:
- `MODAL_TOKEN_ID`
- `MODAL_TOKEN_SECRET`
4. Restart the application
""")
gr.Markdown("## πŸ“± Generated Social Media Content")
with gr.Row():
with gr.Column():
linkedin_output = gr.Textbox(label="πŸ’Ό LinkedIn Post", lines=8)
instagram_output = gr.Textbox(label="πŸ“Έ Instagram Caption", lines=6)
with gr.Column():
tiktok_output = gr.Textbox(label="🎡 TikTok Caption", lines=4)
twitter_output = gr.Textbox(label="🐦 Twitter/𝕏 Post", lines=4)
facebook_output = gr.Textbox(label="πŸ“˜ Facebook Post", lines=6)
# status = gr.Markdown("Ready to generate content!")
# Image output component
# with gr.Row():
# generated_image = gr.Image(
# label="πŸ–ΌοΈ Generated Image",
# visible=False,
# height=512
# )
# Update component visibility based on modal toggle
def update_modal_components_visibility(use_modal):
"""Update visibility of Modal-dependent components"""
is_visible = use_modal and MODAL_AVAILABLE
return gr.Group(visible=is_visible) # model_group
modal_toggle.change(
fn=update_modal_components_visibility,
inputs=[modal_toggle],
outputs=model_group
)
# Connect the function with proper outputs
run_button.click(
fn=generate_all_content,
inputs=[
business_type,
target_audience,
content_goal,
brand_name,
key_message,
modal_toggle,
model_selector
],
outputs=[
linkedin_output,
instagram_output,
tiktok_output,
twitter_output,
facebook_output
]
)
# Add examples
gr.Examples(
examples=[
[
"Digital Marketing Agency",
"Small Business Owners",
"Generate leads with our new social media strategy",
"GrowthHack Marketing",
"Our proven 3-step framework can help you 3x your online visibility in just 30 days. Ready to transform your social media presence?",
MODAL_AVAILABLE,
"**πŸ“£ Announcing Our Proven 3-Step Framework to Triple Your Online Visibility in Just 30 Days! **\n \n Are you tired of seeing your competitors outshine you on social media? Struggling to generate leads and build brand awareness online? Look no further than GrowthHack Marketing's proven 3-step framework.\n \n **Step 1: Identify Your Target Audience**\n By pinpointing the ideal demographics, interests, and behaviors of your potential customers, you can tailor your content to resonate with them on a deeper level. This not only increases engagement but also positions you as an industry expert in their eyes.\n \n **Step 2: Craft Engaging Content**\n Your social media posts must grab attention and pique curiosity. Utilize eye-catching visuals, compelling headlines, and thought-provoking questions to create a buzz around your brand. Remember, great content not only attracts new followers but also retains existing ones!\n \n **Step 3: Optimize for Social Media Platforms**\n To maximize reach, each social media platform requires unique strategies tailored to its specific audience and algorithms. For instance, LinkedIn caters to professionals, while Instagram focuses on visual storytelling. Our team can help you optimize your content for each channel, ensuring your message reaches the right people at the right time.\n \n **πŸ”‘ Takeaway**\n Transform your social media presence with our 3-step framework designed to triple your online visibility in just 30 days! Are you ready to outshine competitors and generate leads? Contact us today! #SocialMediaMarketing #DigitalMarketing #SmallBusiness #ContentMarketing #GrowthHackMarketing",
"πŸ“ˆ Ready to triple your online visibility in just 30 days? πŸš€ Our proven 3-step framework can help you transform your social media presence. πŸ’ͺ\n \n πŸ”Ž Discover the secrets to engaging content, targeted hashtags, and effective community management that attracts your ideal audience. 🌐\n \n πŸ”₯ Join the hundreds of businesses who have seen real results with our social media strategy. Ready to level up? πŸ’Ό\n \n πŸ‘‰ Contact us today for a free consultation and let's grow together! 🌍✨ #SocialMediaMarketing #SmallBusinessOwner #GrowthHackMarketing #DigitalMarketingAgency #OnlineVisibility #TripleYourReach #TransformYourPresence #EngagingContent #TargetedHashtags #EffectiveCommunityManagement #LevelUp #JoinTheMovement",
"πŸ“£πŸ“ˆ Small Business Owners! πŸš€\n Struggling to stand out on social media? πŸ€”\n Our proven 3-step framework can help you 3x your online visibility in just 30 days! 🀩\n Ready to transform your social media presence and attract more customers? 🌟\n πŸ” Step 1: Optimize Your Social Media Profiles\n πŸš€ Step 2: Engage & Connect with Your Audience\n πŸ’ͺ Step 3: Create Shareable Content\n #socialmedia #digitalmarketing #smallbusiness #growthhack #transformation\n Join us and let's grow together! 🀝🏼 #teammates #businesscommunity #growthmindset",
"Struggling to stand out on social media? Our 3-step framework can help you 3x your online visibility in just 30 days! πŸš€ Transform your presence with GrowthHack Marketing. #SocialMediaMarketing #SmallBusiness #DigitalMarketing #GrowthHacks\n \n Are you ready to take the first step towards a more effective social media strategy? Let us know below! #AskGrowthHack πŸ’¬",
"πŸš€ Boost Your Social Media Presence with GrowthHack Marketing's Proven Framework! πŸ“ˆ\n \n Hey, Small Business Owners! Are you struggling to get your brand noticed online? We understand the challenges of standing out in a crowded digital landscape. That's why we've developed a powerful 3-step framework that can help you 3x your online visibility in just 30 days! πŸ’‘\n \n Our team at GrowthHack Marketing has spent years honing our expertise in social media marketing. We've seen what works and what doesn't, and we're excited to share our secrets with you! 🀝\n \n Step 1: Targeted Audience Research 🎯\n Identify your ideal customers and create buyer personas. Understand their interests, pain points, and preferences so you can tailor your content to resonate with them.\n \n Step 2: Consistent Branding & Messaging ✨\n Develop a strong brand identity and ensure that all your social media channels are aligned. Your messaging should be clear, consistent, and engaging to attract and retain followers.\n \n Step 3: Engaging Content Strategy πŸ“…\n Create a content calendar filled with valuable, educational, and entertaining posts. Use visuals, videos, and storytelling to capture the attention of your audience and encourage engagement.\n \n 🌟 Personal Story: I remember when my small bakery was just starting out, it was a struggle to get noticed online among all the big players in the industry. Once we applied these principles, our social media presence exploded! We saw increased traffic to our website, higher engagement rates, and more sales than ever before. 🀩\n \n How about you? Have you tried any of these strategies in your own business? Share your success stories below or message us directly for a free consultation on how we can help you take your social media game to the next level! #SocialMediaMarketing #SmallBusiness #GrowthHack πŸ’‘πŸ“ˆ #DigitalMarketingAgency"
],
[
"Life & Business Coach",
"Aspiring Entrepreneurs",
"Share daily motivation and business tips",
"SuccessPath Coaching",
"Your mindset determines your success. Start each day with purpose and watch your business grow. #MindsetMonday",
MODAL_AVAILABLE,
"Kickstart Your Week with a Winning Mindset! πŸš€\n\n Aspiring entrepreneurs, today's your day! Embrace the power of a positive mindset to fuel your business growth. πŸ’‘\n\n Here are three key insights that can help you stay focused and motivated as you embark on your entrepreneurial journey:\n 1. Your thoughts shape your reality: Cultivate a mindset that's solution-oriented, resilient, and optimistic.\n 2. Persistence pays off: Embrace challenges as opportunities to learn and grow – it's all part of the process! πŸ’ͺ\n 3. Surround yourself with positivity: Seek out mentors, peers, and resources that inspire and uplift you.\n\n By starting your week with a winning mindset, you'll be able to tackle challenges head-on, maintain a positive attitude through setbacks, and attract opportunities for success. 🌈\n\n So go ahead – take the first step towards unlocking your full potential today! #EntrepreneurMindset #BusinessGrowth #SuccessPathCoaching πŸš€βœ¨\n \n 5. PRO TIP: Engage with your audience by asking questions or starting a conversation in the comments section. This will help you build a community around your brand and establish yourself as a thought leader in your industry.",
"πŸ’ͺ Day 1 of our 30-Day Wellness Challenge! πŸ’ͺ\n\nSwipe to see today's quick workout that you can do anywhere, anytime! No gym required. \n\nTag your workout buddy and challenge them to join you! Who's in? πŸ‘‡\n\n#30DayChallenge #HomeWorkout #FitnessMotivation #WellnessJourney #HealthyLifestyle #NoExcuses #WorkoutFromHome #VitalityHub #HealthyHabits #SelfCareSunday",
"πŸ₯— MEAL PREP SUNDAY 🍱\n\nSave this post for your weekly meal prep inspiration! These balanced meals will keep you energized all week long. \n\nWhich one looks most delicious? Let us know in the comments! πŸ‘‡\n\n#MealPrep #HealthyEating #MealPrepSunday #HealthyRecipes #MealPrepIdeas #CleanEating #HealthyFood #NutritionTips #VitalityHub #WellnessJourney #HealthyLifestyle",
"Morning routine that changed my life: 1) 5 min meditation 2) Lemon water 3) 10-min stretch 4) Gratitude journaling. What's in your morning routine? #WellnessTips #MorningRoutine #SelfCare #VitalityHub",
"🌟 Client Spotlight: Meet Sarah! 🌟\n\nSarah joined our 30-day wellness challenge feeling exhausted and overwhelmed. After just 4 weeks of following our program, she's lost 8 pounds, has more energy than ever, and says she's never felt better!\n\n\"I was skeptical at first, but the personalized approach made all the difference. The small, sustainable changes were easy to stick to, even with my busy schedule.\" - Sarah K.\n\nReady to start your own transformation? Our next challenge starts Monday! Comment 'CHALLENGE' below and we'll send you all the details. #SuccessStory #WellnessJourney #HealthTransformation #VitalityHub #HealthyLifestyle #WellnessChallenge #HealthGoals #SelfImprovement"
],
# Plantilla 2: Tienda de Ropa Sostenible
[
"Sustainable Fashion Brand",
"Eco-Conscious Millennials",
"Promote our new eco-friendly collection",
"GreenThread",
"Our new collection is made from 100% organic cotton and recycled materials. Style meets sustainability!",
MODAL_AVAILABLE,
"**🌿 New Arrivals at GreenThread: Style Meets Sustainability πŸ’š**\n \n Hello, eco-conscious millennials! We're thrilled to announce the arrival of our latest collection at GreenThread. Our new line is not just about styleβ€”it's a commitment to reducing our environmental footprint.\n \n **Organic Cotton: A Sustainable Solution**\n \n Did you know that conventional cotton farming uses more than 20% of the world's insecticides and 10% of pesticides? Our new collection is made from 100% organic cotton, grown without harmful chemicals. This ensures a healthier environment and safer working conditions for farmers.\n \n **Recycled Materials: A Circular Economy**\n \n The fashion industry contributes significantly to landfill waste. By using recycled materials in our new collection, we're proudly participating in the circular economy. Each piece is made from pre-loved fabrics and materials, giving them a new life while reducing waste.\n \n **Join Our Sustainability Journey**\n \n At GreenThread, we believe that fashion can be both stylish and sustainable. By choosing our eco-friendly collection, you're making a differenceβ€”not just for yourself but for the planet.\n \n **Takeaway:** The next time you shop, remember that your choices have an impact on people and the environment. Choose brands committed to sustainability and make a positive difference! 🌿🌍\n \n #SustainableFashion #OrganicCotton #RecycledMaterials #EcoFriendly #CircularEconomy #GreenLiving #ConsciousConsumerism #ReduceWaste",
"🌿 New Arrivals at GreenThread! πŸ’š\n πŸ‘— Our latest collection is made from 100% organic cotton and recycled materials. Style meets sustainability! 🌍✨\n πŸ›οΈ Shop now and join the eco-revolution! πŸŒ±πŸ’– #SustainableFashion #OrganicCotton #RecycledMaterials #EcoFriendly #GreenLiving #ShopSmall #EthicalFashion #ConsciousConsumer #SlowFashion\n πŸŽ‰ Let's make a difference together! 🌍❀️",
"πŸŒΏπŸ‘—πŸ•ŠοΈ Introducing our newest collection at GreenThread 🌍! Style meets sustainability with our eco-friendly pieces made from 100% organic cotton and recycled materials πŸ’šβœ¨\n Step into Spring in style, while doing your part for the planet πŸŒ±πŸ’–\n Join us in spreading awareness about sustainable fashion. Share this post and use #GreenThreadCollection #EcoFriendlyFashion #SustainableLiving #OrganicCotton #RecycledMaterials",
"πŸŒΏπŸ‘— Introducing GreenThread's latest collection, where style meets sustainability! 🌍✨ Made from 100% organic cotton and recycled materials. Which eco-friendly piece speaks to you? #SustainableFashion #GreenLiving #EcoFriendlyFashion\n #ShopTheLook πŸ›οΈ Discover our new collection now at GreenThread.com βœ¨πŸŒ±πŸ’š #GreenThread #OrganicCotton #RecycledMaterials",
"🌟 Hey GreenThread Community! 🌍\n πŸš€ Exciting news for all our eco-conscious fashionistas: Our new collection is here! ✨\n πŸ’š Made from 100% organic cotton and recycled materials, our latest styles are not just a feast for the eyes but also kind to Mother Earth. 🌿\n Join us in our mission to make sustainable fashion the norm, one stylish step at a time! πŸ‘œ\n 🌱 Personal story: I remember when my sister used to wear polyester clothes growing up. She'd sweat profusely during summer and couldn't wait to take them off once she got home. Today, we have the power to make better choices with our fashion purchases! What's your favorite sustainable clothing item? πŸ‘•\n #SustainableFashion #OrganicCotton #EcoFriendlyClothes #RecycledMaterials #GreenThreadCommunity\n 🌍 Share this post with a friend who could use some eco-friendly fashion inspiration! Let's spread the word and create a positive impact together! πŸ’–πŸŒŽ",
],
# Plantilla 3: Servicio de ConsultorΓ­a de Salud
[
"Health & Wellness Coach",
"Busy Professionals",
"Promote our 30-day wellness challenge",
"Vitality Hub",
"Transform your health in just 30 days with our expert-guided wellness program",
MODAL_AVAILABLE,
"🌟 30-Day Wellness Challenge: Transform Your Health! 🌟\n\nAre you ready to feel more energized, focused, and vibrant? Join our 30-day wellness challenge designed specifically for busy professionals like you!\n\nWhat's included:\nβœ… Personalized nutrition plan\nβœ… 20-min daily workouts\nβœ… Mindfulness exercises\nβœ… Sleep optimization tips\nβœ… Weekly check-ins with our coaches\n\nLimited spots available! Sign up now at [link in bio] #WellnessJourney #HealthyLifestyle #SelfCare #WellnessChallenge #HealthCoaching #VitalityHub #HealthyHabits #WellnessTransformation",
"πŸ’ͺ Day 1 of our 30-Day Wellness Challenge! πŸ’ͺ\n\nSwipe to see today's quick workout that you can do anywhere, anytime! No gym required. \n\nTag your workout buddy and challenge them to join you! Who's in? πŸ‘‡\n\n#30DayChallenge #HomeWorkout #FitnessMotivation #WellnessJourney #HealthyLifestyle #NoExcuses #WorkoutFromHome #VitalityHub #HealthyHabits #SelfCareSunday",
"πŸ₯— MEAL PREP SUNDAY 🍱\n\nSave this post for your weekly meal prep inspiration! These balanced meals will keep you energized all week long. \n\nWhich one looks most delicious? Let us know in the comments! πŸ‘‡\n\n#MealPrep #HealthyEating #MealPrepSunday #HealthyRecipes #MealPrepIdeas #CleanEating #HealthyFood #NutritionTips #VitalityHub #WellnessJourney #HealthyLifestyle",
"Morning routine that changed my life: 1) 5 min meditation 2) Lemon water 3) 10-min stretch 4) Gratitude journaling. What's in your morning routine? #WellnessTips #MorningRoutine #SelfCare #VitalityHub",
"🌟 Client Spotlight: Meet Sarah! 🌟\n\nSarah joined our 30-day wellness challenge feeling exhausted and overwhelmed. After just 4 weeks of following our program, she's lost 8 pounds, has more energy than ever, and says she's never felt better!\n\n\"I was skeptical at first, but the personalized approach made all the difference. The small, sustainable changes were easy to stick to, even with my busy schedule.\" - Sarah K.\n\nReady to start your own transformation? Our next challenge starts Monday! Comment 'CHALLENGE' below and we'll send you all the details. #SuccessStory #WellnessJourney #HealthTransformation #VitalityHub #HealthyLifestyle #WellnessChallenge #HealthGoals #SelfImprovement"
],
# Plantilla 4: Academia de Idiomas Online
[
"Online Language School",
"Adults & Professionals",
"Promote our summer intensive courses",
"LinguaPro",
"Achieve fluency faster with our immersive online language programs. Summer registration now open!",
MODAL_AVAILABLE,
"🌍✨ Summer Language Intensive: Learn a New Language in 8 Weeks! ✨🌍\n\nReady to add a valuable skill to your resume or prepare for that dream vacation? Our summer intensive courses are designed to get you speaking confidently in just 8 weeks!\n\nπŸ”Ή 6 languages available\nπŸ”Ή Native-speaking instructors\nπŸ”Ή Small group classes (max 6 students)\nπŸ”Ή Flexible scheduling for professionals\n\nEarly bird pricing ends soon! Secure your spot today at [link in bio] #LanguageLearning #Bilingual #LearnLanguages #LanguageSchool #LinguaPro #SummerLearning #CareerDevelopment #OnlineEducation #LanguageHack",
"πŸ€” Can you guess what language this is? Swipe to test your skills! πŸ‘‰\n\nComment your answer below and let us know which language you'd love to learn next! 🌎✨\n\n#LanguageLearning #Polyglot #LanguageChallenge #LinguaPro #LearnLanguages #Bilingual #Multilingual #LanguageLover #TravelTheWorld #CulturalExchange #LanguageExchange #StudyAbroad #OnlineLearning #EducationForAll",
"πŸš€ 3 COMMON MISTAKES English Learners Make (And How to Fix Them!)\n\nSwipe through to see if you're making any of these common mistakes! πŸ‘‰\n\n1. Saying 'I have 25 years' instead of 'I'm 25 (years old)'\n2. Using 'funny' when you mean 'fun'\n3. Saying 'more better' instead of just 'better'\n\nWhich of these mistakes did you used to make? Let us know in the comments! πŸ‘‡\n\n#EnglishTips #LearnEnglish #EnglishMistakes #LanguageLearning #ESL #EnglishTeacher #LinguaPro #EnglishClass #StudyEnglish #LanguageHack #Bilingual #EnglishGrammar #SpeakEnglish",
"🌍 Want to learn Spanish? Our 8-week summer intensive starts soon! Limited spots available. #LearnSpanish #LanguageLearning #LinguaPro #Bilingual #OnlineClasses",
"🌟 Student Spotlight: Meet Carlos! 🌟\n\nWhen Carlos started with us 6 months ago, he knew only basic English phrases. Today, he just aced his job interview in English and got his dream position at an international company! πŸŽ‰\n\n\"I never thought I'd be confident enough to work in English. The personalized attention and practical lessons at LinguaPro made all the difference.\" - Carlos M.\n\nWhat could you achieve with a new language? The possibilities are endless! 🌎✨\n\nOur summer intensive courses start soon. Ready to begin your language journey? Comment 'INFO' and we'll send you the details! #SuccessStory #LanguageLearning #CareerGrowth #LinguaPro #Bilingual #OnlineEducation #LearnLanguages #ProfessionalDevelopment"
],
# Plantilla 5: Estudio de DiseΓ±o GrΓ‘fico
[
"Graphic Design Studio",
"Small Business Owners",
"Showcase our branding package",
"PixelCraft Studio",
"Your brand deserves to stand out. Let us create a visual identity that tells your unique story.",
MODAL_AVAILABLE,
"🎨 Branding That Tells Your Story 🎨\n\nYour brand is more than just a logo - it's the heart and soul of your business. Our comprehensive branding package includes:\n\n✨ Custom logo design\n✨ Brand style guide\n✨ Business card design\n✨ Social media kit\n✨ Email signature design\n\nSwipe to see how we transformed @client's brand with a fresh, modern look that perfectly captures their vision! πŸ‘‰\n\nReady to elevate your brand? Book a free consultation at the link in our bio. #BrandIdentity #LogoDesign #GraphicDesign #Branding #SmallBusinessMarketing #PixelCraftStudio #DesignInspiration #CreativeAgency",
"✨ BEFORE & AFTER: Brand Transformation ✨\n\nSwipe to see how we transformed this local bakery's brand identity! From outdated to outstanding in just 3 weeks. 🍰\n\nOur process:\n1. Discovery call to understand their vision\n2. Market research & mood board creation\n3. Initial concepts presentation\n4. Refinement based on feedback\n5. Final brand package delivery\n\nWhat do you think of the transformation? Let us know in the comments! πŸ‘‡\n\n#BrandMakeover #LogoDesign #BrandIdentity #GraphicDesign #SmallBusiness #BeforeAndAfter #DesignInspiration #CreativeProcess #PixelCraftStudio #BrandDesign",
"πŸš€ 5 BRANDING MISTAKES That Are Costing You Customers πŸš€\n\nSwipe through to see if you're making any of these common branding mistakes! πŸ‘‰\n\n1. Inconsistent visuals across platforms\n2. Not having a clear brand voice\n3. Ignoring your target audience\n4. Overcomplicating your logo\n5. Not investing in professional design\n\nWhich of these mistakes did you used to make? Let's discuss in the comments! πŸ‘‡\n\n#BrandingTips #GraphicDesign #MarketingTips #SmallBusinessOwner #EntrepreneurLife #BrandIdentity #DesignThinking #BusinessGrowth #MarketingStrategy #PixelCraftStudio #BrandDesign",
"Your logo is often the first impression customers have of your business. Make it count! #LogoDesign #BrandIdentity #GraphicDesign #SmallBusiness #PixelCraftStudio",
"🌟 Client Spotlight: Brew Haven CafΓ© β˜•\n\nWe're thrilled to share our recent branding project for @BrewHavenCafe - a cozy neighborhood coffee shop with a passion for artisanal brews and community connection.\n\nOur challenge was to create a warm, inviting brand that reflects their commitment to quality and community. The result? A handcrafted logo, earthy color palette, and rustic design elements that perfectly capture their essence.\n\n\"Working with PixelCraft was a game-changer for our business. They took the time to understand our vision and brought it to life in ways we couldn't have imagined. Our customer feedback has been incredible!\" - Sarah, Owner\n\nSwipe to see the full brand transformation! πŸ‘‰\n\nReady to tell your brand's story? Let's chat! Book a free consultation at the link in our bio. #BrandIdentity #LogoDesign #CoffeeShop #SmallBusiness #Branding #GraphicDesign #DesignInspiration #PixelCraftStudio #ClientWork #BrandTransformation"
]
],
inputs=[
business_type,
target_audience,
content_goal,
brand_name,
key_message,
modal_toggle,
linkedin_output,
instagram_output,
tiktok_output,
twitter_output,
facebook_output
],
label="πŸ’‘ Try these examples"
)
def generate_with_mcp(business_type, target_audience, content_goal, brand_name, key_message):
"""Generate content using the local MCP service"""
return mcp_service.generate_content(
business_type=business_type,
target_audience=target_audience,
content_goal=content_goal,
brand_name=brand_name,
key_message=key_message
)
if __name__ == "__main__":
# Launch the Gradio app
demo.launch(mcp_server=True, share=True)