import streamlit as st from openai import OpenAI import os import json from datetime import datetime, timedelta import streamlit.components.v1 as components def render_ghl_form(): """ Renders the GoHighLevel form using iframe embed """ ghl_form_html = """
""" components.html(ghl_form_html, height=980) # Initialize OpenAI client client = OpenAI(api_key=os.getenv("OPENAI_API_KEY")) def search_current_trends(): """ Uses AI to generate current real estate trends and seasonal content ideas """ current_month = datetime.now().strftime("%B") current_year = datetime.now().year prompt = f""" As a real estate marketing expert, provide current trends and seasonal opportunities for {current_month} {current_year}. Include: 1. Current market trends 2. Seasonal real estate topics 3. Popular hashtags 4. Trending video formats 5. Local market opportunities Focus on what's working NOW in real estate video marketing. """ try: response = client.chat.completions.create( model="gpt-4", messages=[ {"role": "system", "content": "You are a real estate marketing expert with deep knowledge of current trends and seasonal opportunities."}, {"role": "user", "content": prompt} ] ) return response.choices[0].message.content except Exception as e: return f"Unable to fetch current trends: {str(e)}" def generate_content_calendar(realtor_info, market_area, specialties, target_audience, brand_style, current_trends): """ Generates a comprehensive 30-day video content calendar for realtors """ calendar_prompt = f""" Create a detailed 30-day video content calendar for a realtor with these details: Realtor Information: {realtor_info} Market Area: {market_area} Specialties: {specialties} Target Audience: {target_audience} Brand Style: {brand_style} Current Trends: {current_trends} For each day (1-30), provide: **Day X: [Video Title]** - **Content Type**: [Educational/Behind-the-scenes/Market Update/Client Testimonial/Property Showcase/etc.] - **Platform**: [Primary platform - YouTube/Instagram/TikTok/Facebook] - **Duration**: [Recommended length] - **Hook**: [Opening line to grab attention] - **Key Points**: [3-4 main talking points] - **Call-to-Action**: [Specific action for viewers] - **Hashtags**: [5-8 relevant hashtags] - **Equipment Needed**: [Phone/Professional camera/Drone/etc.] - **Location**: [Office/Property/Neighborhood/Home/etc.] **Weekly Themes:** - Week 1: Market Education & Expertise - Week 2: Behind the Scenes & Personal Brand - Week 3: Client Success Stories & Social Proof - Week 4: Market Updates & Future Trends - Days 29-30: Month Recap & Next Month Preview **Content Mix Guidelines:** - 40% Educational content - 25% Property showcases and market updates - 20% Behind-the-scenes and personal branding - 15% Client testimonials and success stories Make each video idea specific, actionable, and designed to establish the realtor as a local market expert while building trust and generating leads. Include seasonal relevance and current market conditions in the content suggestions. """ try: response = client.chat.completions.create( model="gpt-4", messages=[ {"role": "system", "content": "You are a top-tier real estate video marketing strategist who creates viral content calendars that generate leads and establish realtors as local market experts."}, {"role": "user", "content": calendar_prompt} ] ) return response.choices[0].message.content except Exception as e: return f"Error generating calendar: {str(e)}. Please check your OpenAI API key and try again." def generate_bonus_resources(market_area, specialties): """ Generates bonus resources including templates and scripts """ resources_prompt = f""" Create bonus resources for a realtor in {market_area} specializing in {specialties}: 1. **5 Video Script Templates** (with fill-in-the-blank sections) 2. **10 Engaging Video Hooks** for different content types 3. **Social Media Posting Schedule** with optimal times 4. **Video SEO Keywords** for their market area 5. **Equipment Recommendations** by budget level 6. **Trending Audio/Music Suggestions** for each platform Make everything specific to real estate video marketing and lead generation. """ try: response = client.chat.completions.create( model="gpt-4", messages=[ {"role": "system", "content": "You are a real estate marketing expert specializing in video content creation and lead generation strategies."}, {"role": "user", "content": resources_prompt} ] ) return response.choices[0].message.content except Exception as e: return f"Error generating resources: {str(e)}" # Streamlit setup st.set_page_config(page_title="Realtor Video Content Calendar", layout="wide") # Initialize session state if "calendar_content" not in st.session_state: st.session_state["calendar_content"] = None if "bonus_resources" not in st.session_state: st.session_state["bonus_resources"] = None if "show_notice" not in st.session_state: st.session_state["show_notice"] = False # Header st.markdown("

🎥 30-Day Video Content Calendar for Realtors

", unsafe_allow_html=True) st.markdown("

Generate More Leads Through Strategic Video Marketing

", unsafe_allow_html=True) # Create two columns for input col1, col2 = st.columns(2) with col1: st.markdown("### 📋 Realtor Information") realtor_name = st.text_input("Realtor Name", placeholder="John Smith") brokerage = st.text_input("Brokerage", placeholder="ABC Realty") years_experience = st.number_input("Years in Real Estate", min_value=0, max_value=50, value=5) st.markdown("### 🎯 Target Market") market_area = st.text_input("Primary Market Area", placeholder="Downtown Austin, TX") specialties = st.multiselect( "Specialties", ["First-time Homebuyers", "Luxury Properties", "Investment Properties", "Commercial Real Estate", "Relocation Services", "Senior Housing", "New Construction", "Foreclosures/REO", "Land/Lots"] ) with col2: st.markdown("### 👥 Audience & Style") target_audience = st.selectbox( "Primary Target Audience", ["First-time Homebuyers (25-35)", "Move-up Buyers (35-45)", "Luxury Buyers (45+)", "Investors", "Empty Nesters", "Young Families", "Millennials", "Gen Z"] ) brand_style = st.selectbox( "Brand Personality", ["Professional & Trustworthy", "Fun & Energetic", "Luxury & Sophisticated", "Down-to-earth & Relatable", "Tech-savvy & Modern", "Community-focused"] ) video_experience = st.selectbox( "Video Creation Experience", ["Beginner (just starting)", "Intermediate (some experience)", "Advanced (regular creator)"] ) # Additional preferences st.markdown("### ⚙️ Content Preferences") col3, col4 = st.columns(2) with col3: primary_platforms = st.multiselect( "Primary Social Media Platforms", ["Instagram", "TikTok", "YouTube", "Facebook", "LinkedIn"], default=["Instagram", "YouTube"] ) with col4: content_focus = st.multiselect( "Content Focus Areas", ["Market Education", "Property Tours", "Neighborhood Spotlights", "Home Buying/Selling Tips", "Market Updates", "Personal Branding", "Client Success Stories", "Behind-the-scenes"], default=["Market Education", "Property Tours", "Home Buying/Selling Tips"] ) # Contact Information Form st.markdown("---") st.markdown("### 📞 Get Your Free 30-Day Video Calendar") st.markdown("*Complete the form below to receive your personalized video content strategy:*") # Render the GoHighLevel form render_ghl_form() # Simple generate button that doesn't require form validation # Since the GHL form handles contact capture generate_button = st.button('🚀 Generate My 30-Day Video Calendar', type="primary") # Process results on button click if generate_button: # Validate required fields for calendar generation if not realtor_name or not market_area: st.error("Please fill in at least the Realtor Name and Primary Market Area to generate your calendar.") else: st.session_state["show_notice"] = True with st.spinner("🔍 Researching current market trends and generating your personalized video calendar..."): # Compile realtor information specialties_str = ", ".join(specialties) if specialties else "General Real Estate" platforms_str = ", ".join(primary_platforms) if primary_platforms else "All platforms" focus_str = ", ".join(content_focus) if content_focus else "General content" realtor_info = f"{realtor_name} from {brokerage} with {years_experience} years of experience. Video experience level: {video_experience}. Focuses on: {focus_str}. Uses platforms: {platforms_str}" # Get current trends current_trends = search_current_trends() # Generate the calendar st.session_state["calendar_content"] = generate_content_calendar( realtor_info, market_area, specialties_str, target_audience, brand_style, current_trends ) # Generate bonus resources st.session_state["bonus_resources"] = generate_bonus_resources(market_area, specialties_str) st.session_state["show_notice"] = False st.success(f"✅ Your personalized video calendar has been generated! Please complete the contact form above to access additional resources.") # Display the waiting notice if st.session_state["show_notice"]: st.info("🎬 Creating your personalized 30-day video content calendar... This may take 1-2 minutes.") # Display results if st.session_state["calendar_content"]: st.markdown("---") st.markdown("

📅 Your 30-Day Video Content Calendar

", unsafe_allow_html=True) # Create tabs for better organization tab1, tab2 = st.tabs(["📋 Content Calendar", "🎁 Bonus Resources"]) with tab1: st.markdown(st.session_state["calendar_content"]) # Download option st.download_button( label="📥 Download Calendar as Text File", data=st.session_state["calendar_content"], file_name=f"30_day_video_calendar_{datetime.now().strftime('%Y%m%d')}.txt", mime="text/plain" ) with tab2: if st.session_state["bonus_resources"]: st.markdown(st.session_state["bonus_resources"]) # Download option for resources st.download_button( label="📥 Download Resources as Text File", data=st.session_state["bonus_resources"], file_name=f"video_marketing_resources_{datetime.now().strftime('%Y%m%d')}.txt", mime="text/plain" ) # Footer with loan originator value proposition st.markdown("---") st.markdown("""

🏡 Powered by Western Pioneer Financial

Marcus Cavazos - Loan Originator

📧 mcavazos@wpfloans.com | 🏦 NMLS#1938369

🤝 Partnership That Grows Your Business

This free video marketing tool is just one way I support realtors in building their business. When your clients need financing, I provide the exceptional loan services that help you close more deals faster.

⚡ Fast Pre-Approvals

Same-day pre-approval letters

🏆 Competitive Rates

Best rates for your clients

📞 Direct Communication

Always available for updates

Ready to partner with a loan originator who invests in your success?

Contact me today to discuss how we can work together to close more deals.

Western Pioneer Financial | NMLS#1938369 | Equal Housing Opportunity Lender
""", unsafe_allow_html=True)