| 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 = """ |
| <div style="margin: 20px 0;"> |
| <iframe |
| src="https://api.leadconnectorhq.com/widget/form/owzd46RCCEOSQv9u242m" |
| style="width:100%;height:946px;border:none;border-radius:10px;box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);" |
| id="inline-owzd46RCCEOSQv9u242m" |
| data-layout="{'id':'INLINE'}" |
| data-trigger-type="alwaysShow" |
| data-trigger-value="" |
| data-activation-type="alwaysActivated" |
| data-activation-value="" |
| data-deactivation-type="leadCollected" |
| data-deactivation-value="" |
| data-form-name="Marcus Form 1" |
| data-height="946" |
| data-layout-iframe-id="inline-owzd46RCCEOSQv9u242m" |
| data-form-id="owzd46RCCEOSQv9u242m" |
| title="Marcus Form 1" |
| > |
| </iframe> |
| <script src="https://link.msgsndr.com/js/form_embed.js"></script> |
| </div> |
| """ |
| |
| components.html(ghl_form_html, height=980) |
|
|
| |
| 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)}" |
|
|
| |
| st.set_page_config(page_title="Realtor Video Content Calendar", layout="wide") |
|
|
| |
| 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 |
|
|
| |
| st.markdown("<h1 style='text-align: center; color: #2E4057;'>π₯ 30-Day Video Content Calendar for Realtors</h1>", unsafe_allow_html=True) |
| st.markdown("<h3 style='text-align: center; color: #666;'>Generate More Leads Through Strategic Video Marketing</h3>", unsafe_allow_html=True) |
|
|
| |
| 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)"] |
| ) |
|
|
| |
| 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"] |
| ) |
|
|
| |
| 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_ghl_form() |
|
|
| |
| |
| generate_button = st.button('π Generate My 30-Day Video Calendar', type="primary") |
|
|
| |
| if generate_button: |
| |
| 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..."): |
| |
| 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}" |
| |
| |
| current_trends = search_current_trends() |
| |
| |
| st.session_state["calendar_content"] = generate_content_calendar( |
| realtor_info, market_area, specialties_str, target_audience, brand_style, current_trends |
| ) |
| |
| |
| 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.") |
|
|
| |
| if st.session_state["show_notice"]: |
| st.info("π¬ Creating your personalized 30-day video content calendar... This may take 1-2 minutes.") |
|
|
| |
| if st.session_state["calendar_content"]: |
| st.markdown("---") |
| st.markdown("<h2 style='text-align: center; color: #2E4057;'>π
Your 30-Day Video Content Calendar</h2>", unsafe_allow_html=True) |
| |
| |
| tab1, tab2 = st.tabs(["π Content Calendar", "π Bonus Resources"]) |
| |
| with tab1: |
| st.markdown(st.session_state["calendar_content"]) |
| |
| |
| 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"]) |
| |
| |
| 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" |
| ) |
|
|
| |
| st.markdown("---") |
| st.markdown(""" |
| <div style='background-color: white; color: #374151; padding: 25px; border-radius: 10px; margin-top: 30px; border: 2px solid #e5e7eb; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);'> |
| <h2 style='color: #1f2937; text-align: center; margin-bottom: 20px;'>π‘ Powered by Western Pioneer Financial</h2> |
| <div style='text-align: center; margin-bottom: 20px;'> |
| <h3 style='color: #1f2937; margin-bottom: 10px;'>Marcus Cavazos - Loan Originator</h3> |
| <p style='font-size: 16px; margin-bottom: 15px; color: #6b7280;'> |
| π§ <strong style='color: #1f2937;'>mcavazos@wpfloans.com</strong> | π¦ <strong style='color: #1f2937;'>NMLS#1938369</strong> |
| </p> |
| </div> |
| |
| <div style='background-color: #f9fafb; padding: 20px; border-radius: 8px; margin-bottom: 20px; border: 1px solid #e5e7eb;'> |
| <h4 style='color: #1f2937; text-align: center; margin-bottom: 15px;'>π€ Partnership That Grows Your Business</h4> |
| <p style='text-align: center; font-size: 16px; line-height: 1.6; color: #374151;'> |
| 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. |
| </p> |
| </div> |
| |
| <div style='display: flex; justify-content: space-around; flex-wrap: wrap; margin: 20px 0;'> |
| <div style='text-align: center; margin: 10px;'> |
| <h4 style='color: #1f2937;'>β‘ Fast Pre-Approvals</h4> |
| <p style='margin: 5px 0; color: #6b7280;'>Same-day pre-approval letters</p> |
| </div> |
| <div style='text-align: center; margin: 10px;'> |
| <h4 style='color: #1f2937;'>π Competitive Rates</h4> |
| <p style='margin: 5px 0; color: #6b7280;'>Best rates for your clients</p> |
| </div> |
| <div style='text-align: center; margin: 10px;'> |
| <h4 style='color: #1f2937;'>π Direct Communication</h4> |
| <p style='margin: 5px 0; color: #6b7280;'>Always available for updates</p> |
| </div> |
| </div> |
| |
| <div style='text-align: center; margin-top: 20px;'> |
| <p style='font-size: 18px; font-weight: bold; color: #1f2937;'> |
| Ready to partner with a loan originator who invests in your success? |
| </p> |
| <p style='font-size: 16px; margin-top: 10px; color: #374151;'> |
| Contact me today to discuss how we can work together to close more deals. |
| </p> |
| </div> |
| |
| <div style='text-align: center; font-size: 12px; margin-top: 20px; color: #9ca3af;'> |
| Western Pioneer Financial | NMLS#1938369 | Equal Housing Opportunity Lender |
| </div> |
| </div> |
| """, unsafe_allow_html=True) |