Marcus commited on
Commit
be6e021
Β·
verified Β·
1 Parent(s): 3411af2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +318 -481
app.py CHANGED
@@ -1,521 +1,358 @@
1
  import streamlit as st
2
- st.set_page_config(page_title="Video Funnel Generator", layout="wide")
3
-
4
- import requests
5
- import os
6
- from bs4 import BeautifulSoup
7
  from openai import OpenAI
8
- from urllib.parse import urlparse
9
-
10
- # Set the Space URL for your tool on Hugging Face.
11
- SPACE_URL = os.getenv("SPACE_URL", "https://huggingface.co/spaces/nniehaus/Video-Funnel-Planner")
12
-
13
- # Add verbiage to instruct users when to click the wake-up button.
14
- st.markdown("**Note:** If you don't see the tool below, click the button below to turn it on.")
15
-
16
- # Add a wake-up button at the top of the app.
17
- if st.button("Turn on Video Funnel Tool"):
18
- st.info("Attempting to wake up the tool...")
19
- try:
20
- # Sending a GET request to the Space URL to trigger a wake-up.
21
- response = requests.get(SPACE_URL, timeout=10)
22
- if response.status_code == 200:
23
- st.success("The tool is now awake!")
24
- else:
25
- st.error("Unexpected response. Please try again.")
26
- except Exception as e:
27
- st.error(f"Error waking the tool: {str(e)}")
28
 
29
- # Configure OpenAI
30
- openai_api_key = os.getenv("OPENAI_API_KEY")
31
- if not openai_api_key:
32
- st.error("⚠️ OpenAI API key not found. Please set your OPENAI_API_KEY environment variable.")
33
- st.stop()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
- client = OpenAI(api_key=openai_api_key)
 
36
 
37
- def scrape_website(url, max_pages=3):
38
- """Scrapes content from the given website URL."""
39
- if not url.startswith("http"):
40
- url = f"https://{url}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  try:
42
- response = requests.get(url, timeout=10)
43
- response.raise_for_status()
44
- soup = BeautifulSoup(response.content, "html.parser")
45
- content = []
46
- # Get meta description
47
- meta_description = soup.find("meta", {"name": "description"})
48
- if meta_description and meta_description.get("content"):
49
- content.append(meta_description["content"])
50
- # Get main content from h1, h2, and p tags
51
- for tag in ['h1', 'h2', 'p']:
52
- elements = soup.find_all(tag)
53
- content.extend([elem.get_text(strip=True) for elem in elements if elem.get_text(strip=True)])
54
- return " ".join(content[:1500])
55
  except Exception as e:
56
- return None
57
-
58
- def research_business_online(domain_or_name):
59
- """Use OpenAI to research business information when website scraping fails"""
60
- research_prompt = f"""You are a business research analyst. I need you to search for and provide comprehensive information about a business.
61
-
62
- BUSINESS IDENTIFIER: {domain_or_name}
63
-
64
- Please search for current information about this business and provide a detailed analysis including:
65
-
66
- 1. **Business Overview**
67
- - Company name and what they do
68
- - Industry and business model
69
- - Key products or services offered
70
- - Years in business (if available)
71
-
72
- 2. **Target Market Analysis**
73
- - Primary customer demographics
74
- - Geographic markets served
75
- - Customer pain points they address
76
- - Market positioning
77
-
78
- 3. **Online Presence Assessment**
79
- - Social media presence and activity
80
- - Content marketing efforts
81
- - SEO visibility and digital footprint
82
- - Customer reviews and reputation
83
-
84
- 4. **Competitive Landscape**
85
- - Main competitors in their space
86
- - Unique selling propositions
87
- - Market differentiation factors
88
- - Industry trends affecting them
89
-
90
- 5. **Business Insights**
91
- - Revenue model and pricing strategy (if public)
92
- - Growth stage and expansion plans
93
- - Notable partnerships or achievements
94
- - Challenges they likely face
95
-
96
- Please search for current, accurate information and provide specific details rather than generic assumptions. Focus on actionable insights that would help create an effective video marketing strategy.
97
-
98
- If you cannot find specific information about this exact business, please indicate what you couldn't find and provide educated analysis based on similar businesses in the industry."""
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  try:
101
  response = client.chat.completions.create(
102
- model="gpt-5",
103
  messages=[
104
- {"role": "system", "content": "You are a comprehensive business research analyst with access to current web information. Search thoroughly and provide detailed, actionable insights about businesses."},
105
- {"role": "user", "content": research_prompt}
106
- ],
107
- temperature=0.3,
108
- max_tokens=2000
109
  )
110
  return response.choices[0].message.content
111
  except Exception as e:
112
- st.error(f"Research Error: {str(e)}")
113
- return None
114
-
115
- def extract_domain_info(url):
116
- """Extract useful information from the domain name itself"""
117
- try:
118
- if not url.startswith("http"):
119
- url = f"https://{url}"
120
- parsed = urlparse(url)
121
- domain = parsed.netloc.replace("www.", "")
122
-
123
- # Extract potential business name from domain
124
- business_name = domain.split('.')[0]
125
- business_name_formatted = business_name.replace('-', ' ').replace('_', ' ').title()
126
-
127
- return {
128
- 'domain': domain,
129
- 'potential_name': business_name_formatted,
130
- 'full_url': url
131
- }
132
- except:
133
- return None
134
 
135
- def generate_marketing_plan(business_info):
136
- """Generate comprehensive video marketing plan using OpenAI"""
137
- system_prompt = """You are a world-class video marketing strategist who combines proven methodologies from industry leaders:
138
- CORE EXPERTISE:
139
- - Gary Vaynerchuk's "Document Don't Create" philosophy and pattern interruption techniques
140
- - Alex Hormozi's high-value content frameworks and offer psychology
141
- - MrBeast's viral video engineering and thumbnail psychology
142
- - Russell Brunson's funnel optimization and customer journey mapping
143
- - Seth Godin's permission marketing and storytelling principles
144
- SPECIALIZATIONS:
145
- - Behavioral psychology in video engagement (hooks, retention, conversions)
146
- - Platform-specific algorithm optimization (YouTube, TikTok, Instagram, LinkedIn)
147
- - ROI-focused content strategies for small businesses
148
- - Video SEO and discoverability tactics
149
- - Mobile-first content creation
150
- - Community building through video content
151
- 2025 FOCUS AREAS:
152
- - AI-powered personalization at scale
153
- - Short-form video dominance across platforms
154
- - Authentic storytelling over polished production
155
- - Interactive and shoppable video content
156
- - Cross-platform content repurposing strategies
157
- - Privacy-first marketing approaches
158
- YOUR APPROACH:
159
- - Every recommendation must be immediately actionable
160
- - Focus on high-impact, low-cost strategies first
161
- - Provide specific examples, not generic advice
162
- - Include exact metrics and timelines
163
- - Account for resource constraints of small businesses
164
- - Emphasize testing and optimization over perfection
165
- TONE: Professional but accessible, confident but humble, data-driven but creative"""
166
-
167
- user_prompt = f"""As a leading video marketing strategist, analyze this business and create an immediately actionable video funnel strategy:
168
- BUSINESS INFORMATION:
169
- {business_info}
170
- Create a comprehensive video marketing funnel report with the following structure:
171
- # 🎯 EXECUTIVE SUMMARY
172
- Provide a 3-sentence summary of the biggest opportunities and immediate next steps for this business.
173
- # πŸ” BUSINESS ANALYSIS
174
- ## Target Audience Profile
175
- - Primary demographics and psychographics
176
- - Key pain points and desires
177
- - Where they spend time online
178
- - Content consumption preferences
179
- ## Competitive Landscape
180
- - 3 key differentiators for this business
181
- - Content gaps in their market
182
- - Opportunities to stand out
183
- # πŸ“Ή VIDEO FUNNEL STRATEGY
184
- ## AWARENESS STAGE (Top of Funnel)
185
- **Goal:** Attract and educate potential customers who don't know you exist
186
- ### Video Content Ideas (Choose 2-3 to start):
187
- 1. **[Specific Video Title]**
188
- - Format: [Short-form/Long-form/Live]
189
- - Platform: [Primary platform]
190
- - Hook: [Specific opening line]
191
- - Key Message: [What viewer learns]
192
- - CTA: [Specific next step]
193
- 2. **[Specific Video Title]**
194
- - Format: [Short-form/Long-form/Live]
195
- - Platform: [Primary platform]
196
- - Hook: [Specific opening line]
197
- - Key Message: [What viewer learns]
198
- - CTA: [Specific next step]
199
- 3. **[Specific Video Title]**
200
- - Format: [Short-form/Long-form/Live]
201
- - Platform: [Primary platform]
202
- - Hook: [Specific opening line]
203
- - Key Message: [What viewer learns]
204
- - CTA: [Specific next step]
205
- ### Success Metrics:
206
- - Views, Reach, Brand Lift, Click-through Rate
207
- ## CONSIDERATION STAGE (Middle of Funnel)
208
- **Goal:** Build trust and demonstrate expertise with warm prospects
209
- ### Video Content Ideas (Choose 2-3 to start):
210
- 1. **[Specific Video Title]**
211
- - Format: [Short-form/Long-form/Live]
212
- - Platform: [Primary platform]
213
- - Hook: [Specific opening line]
214
- - Key Message: [What viewer learns]
215
- - CTA: [Specific next step]
216
- 2. **[Specific Video Title]**
217
- - Format: [Short-form/Long-form/Live]
218
- - Platform: [Primary platform]
219
- - Hook: [Specific opening line]
220
- - Key Message: [What viewer learns]
221
- - CTA: [Specific next step]
222
- ### Success Metrics:
223
- - Engagement Rate, Video Completion Rate, Email Sign-ups
224
- ## CONVERSION STAGE (Bottom of Funnel)
225
- **Goal:** Convert qualified prospects into paying customers
226
- ### Video Content Ideas (Choose 1-2 to start):
227
- 1. **[Specific Video Title]**
228
- - Format: [Short-form/Long-form/Live]
229
- - Platform: [Primary platform]
230
- - Hook: [Specific opening line]
231
- - Key Message: [What viewer learns]
232
- - CTA: [Specific next step]
233
- 2. **[Specific Video Title]**
234
- - Format: [Short-form/Long-form/Live]
235
- - Platform: [Primary platform]
236
- - Hook: [Specific opening line]
237
- - Key Message: [What viewer learns]
238
- - CTA: [Specific next step]
239
- ### Success Metrics:
240
- - Conversion Rate, Cost Per Acquisition, Sales Revenue
241
- ## RETENTION/ADVOCACY STAGE
242
- **Goal:** Keep customers engaged and turn them into advocates
243
- ### Video Content Ideas:
244
- 1. **[Specific Video Title]** - [Brief description and purpose]
245
- 2. **[Specific Video Title]** - [Brief description and purpose]
246
- # 🎬 PRODUCTION GUIDELINES
247
- ## Visual Style
248
- - **Color Palette:** [Specific colors that align with brand]
249
- - **Filming Style:** [Documentary/Polished/Casual/etc.]
250
- - **Lighting:** [Natural/Professional setup recommendations]
251
- ## Audio Considerations
252
- - **Music Style:** [Upbeat/Calm/Inspiring/etc.]
253
- - **Voiceover Tone:** [Professional/Conversational/Energetic/etc.]
254
- ## Text & Graphics
255
- - **Font Style:** [Modern/Classic/Bold/etc.]
256
- - **Text Overlay Strategy:** [When and how to use]
257
- - **Thumbnail Style:** [High-contrast/Face focus/Text-heavy/etc.]
258
- # πŸ“Š PLATFORM STRATEGY
259
- ## Primary Platform: [Platform Name]
260
- - **Posting Frequency:** [Specific schedule]
261
- - **Optimal Post Times:** [Specific times and days]
262
- - **Hashtag Strategy:** [5-10 specific hashtags]
263
- - **Community Engagement:** [Specific tactics]
264
- ## Secondary Platform: [Platform Name]
265
- - **Content Adaptation:** [How to repurpose]
266
- - **Posting Schedule:** [Frequency and timing]
267
- - **Unique Features:** [Platform-specific tactics]
268
- # ⚑ 90-DAY ACTION PLAN
269
- ## Month 1: Foundation
270
- **Week 1-2:**
271
- - [ ] Create [specific video #1]
272
- - [ ] Set up posting schedule on [platform]
273
- - [ ] Design thumbnail templates
274
- **Week 3-4:**
275
- - [ ] Create [specific video #2]
276
- - [ ] Launch awareness campaign
277
- - [ ] Engage with comments and build community
278
- ## Month 2: Optimization
279
- **Week 5-6:**
280
- - [ ] Analyze performance data
281
- - [ ] Create [specific video #3]
282
- - [ ] Test different posting times
283
- **Week 7-8:**
284
- - [ ] Launch consideration stage content
285
- - [ ] Begin retargeting campaigns
286
- - [ ] Collect feedback and testimonials
287
- ## Month 3: Scale
288
- **Week 9-10:**
289
- - [ ] Create conversion-focused videos
290
- - [ ] Implement email capture strategy
291
- - [ ] Launch on secondary platform
292
- **Week 11-12:**
293
- - [ ] Analyze full funnel performance
294
- - [ ] Plan content for next quarter
295
- - [ ] Scale successful content formats
296
- # πŸ“ˆ MEASUREMENT FRAMEWORK
297
- ## Key Performance Indicators
298
- ### Awareness Metrics:
299
- - **Reach:** [Target number]
300
- - **Impressions:** [Target number]
301
- - **Brand Lift:** [Measurement method]
302
- ### Consideration Metrics:
303
- - **Engagement Rate:** [Target percentage]
304
- - **Video Completion Rate:** [Target percentage]
305
- - **Email Sign-ups:** [Target number]
306
- ### Conversion Metrics:
307
- - **Lead-to-Customer Rate:** [Target percentage]
308
- - **Cost Per Acquisition:** [Target amount]
309
- - **Revenue Attribution:** [Tracking method]
310
- ## Monthly Review Process
311
- 1. **Data Collection:** [Specific tools and metrics]
312
- 2. **Performance Analysis:** [What to look for]
313
- 3. **Optimization Actions:** [How to improve]
314
- 4. **Content Planning:** [Next month's focus]
315
- # πŸš€ IMMEDIATE NEXT STEPS
316
- ## This Week:
317
- 1. **[Specific action with deadline]**
318
- 2. **[Specific action with deadline]**
319
- 3. **[Specific action with deadline]**
320
- ## This Month:
321
- 1. **[Specific milestone]**
322
- 2. **[Specific milestone]**
323
- 3. **[Specific milestone]**
324
- ## Success Indicators:
325
- By implementing this strategy, you should see:
326
- - [Specific metric improvement] within 30 days
327
- - [Specific metric improvement] within 60 days
328
- - [Specific metric improvement] within 90 days
329
- Remember: The key to video marketing success is consistency and testing. Start with one platform, master your content format, then scale to additional channels."""
330
 
331
  try:
332
  response = client.chat.completions.create(
333
  model="gpt-4",
334
  messages=[
335
- {"role": "system", "content": system_prompt},
336
- {"role": "user", "content": user_prompt}
337
- ],
338
- temperature=0.7,
339
- max_tokens=4000
340
  )
341
  return response.choices[0].message.content
342
  except Exception as e:
343
- st.error(f"OpenAI API Error: {str(e)}")
344
- return None
345
 
346
- # Enhanced UI with better visual hierarchy
347
- st.title("πŸŽ₯ Video Funnel Strategist")
348
- st.markdown("### Generate a comprehensive, actionable video marketing funnel for your business")
349
 
350
- # Add value proposition
351
- st.info("πŸ’‘ **Get a complete 90-day video marketing roadmap** with specific content ideas, production guidelines, and measurable success metrics tailored to your business.")
 
 
 
 
 
352
 
353
- input_method = st.radio(
354
- "Choose input method:",
355
- ["Enter business details manually", "Use website URL"]
356
- )
357
 
358
- if input_method == "Enter business details manually":
359
- col1, col2 = st.columns(2)
 
 
 
 
 
 
360
 
361
- with col1:
362
- business_name = st.text_input("Business Name*", help="The name of your company or brand")
363
- business_description = st.text_area(
364
- "What does your company do?*",
365
- help="Describe your products/services and what makes you unique",
366
- height=100
367
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
368
 
369
- with col2:
370
- ideal_client = st.text_area(
371
- "Describe your ideal client*",
372
- help="Include demographics, challenges they face, and why they need your solution",
373
- height=100
374
- )
375
- current_marketing = st.text_area(
376
- "Current marketing efforts (optional)",
377
- help="What marketing strategies are you currently using? What's working/not working?",
378
- height=60
379
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
380
 
381
- # Additional context fields
382
- st.markdown("**Additional Context (Optional)**")
383
- col3, col4 = st.columns(2)
384
 
385
- with col3:
386
- budget_range = st.selectbox(
387
- "Monthly video marketing budget",
388
- ["Under $500", "$500-$1,500", "$1,500-$5,000", "$5,000-$15,000", "Over $15,000"],
389
- help="This helps tailor recommendations to your resources"
390
- )
391
 
392
- with col4:
393
- experience_level = st.selectbox(
394
- "Video marketing experience",
395
- ["Complete beginner", "Some experience", "Intermediate", "Advanced"],
396
- help="We'll adjust complexity based on your comfort level"
 
397
  )
398
 
399
- if st.button("πŸš€ Generate My Video Marketing Strategy", type="primary"):
400
- if not all([business_name, business_description, ideal_client]):
401
- st.error("⚠️ Please fill in all required fields marked with *")
402
- else:
403
- with st.spinner("🎬 Creating your custom video marketing strategy..."):
404
- business_info = f"""
405
- Business Name: {business_name}
406
- Business Description: {business_description}
407
- Ideal Client Profile: {ideal_client}
408
- Current Marketing: {current_marketing if current_marketing else 'Not provided'}
409
- Budget Range: {budget_range}
410
- Experience Level: {experience_level}
411
- """
412
- plan = generate_marketing_plan(business_info)
413
- if plan:
414
- # Enhanced output display
415
- st.success("βœ… Your video marketing strategy is ready!")
416
- st.markdown("---")
417
- st.markdown(plan)
418
-
419
- # Add download option
420
- st.markdown("---")
421
- st.download_button(
422
- label="πŸ“₯ Download Strategy as Text File",
423
- data=plan,
424
- file_name=f"{business_name}_video_marketing_strategy.txt",
425
- mime="text/plain"
426
- )
427
- else:
428
- website_url = st.text_input(
429
- "Enter your website URL*",
430
- placeholder="e.g., www.example.com or https://example.com",
431
- help="We'll analyze your website to understand your business and create a tailored strategy"
432
- )
433
-
434
- if st.button("πŸš€ Generate My Video Marketing Strategy", type="primary"):
435
- if not website_url:
436
- st.error("⚠️ Please enter your website URL")
437
- else:
438
- with st.spinner("πŸ” Analyzing your website and creating your marketing strategy..."):
439
- # First, try to scrape the website directly
440
- website_content = scrape_website(website_url)
441
-
442
- if website_content:
443
- st.success("βœ… Website successfully analyzed!")
444
- business_info = f"""
445
- Website URL: {website_url}
446
- Website Content Analysis: {website_content}
447
- """
448
- else:
449
- # If direct scraping fails, use research approach
450
- st.warning("⚠️ Direct website access failed. Researching your business through alternative methods...")
451
-
452
- # Extract domain information
453
- domain_info = extract_domain_info(website_url)
454
-
455
- # Research the business online
456
- if domain_info:
457
- research_target = domain_info['potential_name']
458
- st.info(f"πŸ” Researching information about: {research_target}")
459
- else:
460
- research_target = website_url
461
-
462
- with st.spinner("πŸ“Š Gathering comprehensive business intelligence..."):
463
- research_results = research_business_online(research_target)
464
-
465
- if research_results:
466
- st.success("βœ… Business research completed successfully!")
467
- business_info = f"""
468
- Website URL: {website_url}
469
- Business Research Results: {research_results}
470
- Research Method: Online business intelligence gathering (website direct access was not available)
471
- """
472
- else:
473
- st.error("❌ Unable to gather sufficient information about your business. Please try the manual input method instead.")
474
- st.stop()
475
-
476
- # Generate the marketing plan with the gathered information
477
- with st.spinner("🎬 Creating your personalized video marketing strategy..."):
478
- plan = generate_marketing_plan(business_info)
479
- if plan:
480
- st.success("βœ… Your video marketing strategy is ready!")
481
- st.markdown("---")
482
- st.markdown(plan)
483
-
484
- # Add download option
485
- st.markdown("---")
486
- st.download_button(
487
- label="πŸ“₯ Download Strategy as Text File",
488
- data=plan,
489
- file_name="video_marketing_strategy.txt",
490
- mime="text/plain"
491
- )
492
 
493
- # Add helpful resources section
494
  st.markdown("---")
495
- st.markdown("### πŸ“š Quick Video Marketing Tips")
 
 
 
 
 
 
 
 
496
 
497
- tip_cols = st.columns(3)
 
 
 
 
 
 
498
 
499
- with tip_cols[0]:
500
- st.markdown("""
501
- **🎯 Hook Formula**
502
- - Pattern interrupt (3 sec)
503
- - Promise value (7 sec)
504
- - Preview content (15 sec)
505
- """)
 
 
 
 
 
 
 
506
 
507
- with tip_cols[1]:
508
- st.markdown("""
509
- **πŸ“± Platform Priorities**
510
- - Short-form: TikTok, IG Reels
511
- - Long-form: YouTube
512
- - Professional: LinkedIn
513
- """)
 
514
 
515
- with tip_cols[2]:
516
- st.markdown("""
517
- **πŸ“Š Key Metrics**
518
- - Awareness: Reach, Views
519
- - Engagement: Comments, Shares
520
- - Conversion: Click-through, Sales
521
- """)
 
1
  import streamlit as st
 
 
 
 
 
2
  from openai import OpenAI
3
+ import os
4
+ import json
5
+ from datetime import datetime, timedelta
6
+ import streamlit.components.v1 as components
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
+ def render_ghl_form():
9
+ """
10
+ Renders the GoHighLevel form using iframe embed
11
+ """
12
+ ghl_form_html = """
13
+ <div style="margin: 20px 0;">
14
+ <iframe
15
+ src="https://api.leadconnectorhq.com/widget/form/9RwsrMPNTcf38VGQv79N"
16
+ style="width:100%;height:600px;border:none;border-radius:10px;box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);"
17
+ id="popup-9RwsrMPNTcf38VGQv79N"
18
+ data-layout="{'id':'POPUP'}"
19
+ data-trigger-type="alwaysShow"
20
+ data-trigger-value=""
21
+ data-activation-type="alwaysActivated"
22
+ data-activation-value=""
23
+ data-deactivation-type="neverDeactivate"
24
+ data-deactivation-value=""
25
+ data-form-name="Form 2"
26
+ data-height="undefined"
27
+ data-layout-iframe-id="popup-9RwsrMPNTcf38VGQv79N"
28
+ data-form-id="9RwsrMPNTcf38VGQv79N"
29
+ title="Realtor Contact Form"
30
+ >
31
+ </iframe>
32
+ <script src="https://link.msgsndr.com/js/form_embed.js"></script>
33
+ </div>
34
+ """
35
+
36
+ components.html(ghl_form_html, height=650)
37
 
38
+ # Initialize OpenAI client
39
+ client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
40
 
41
+ def search_current_trends():
42
+ """
43
+ Uses AI to generate current real estate trends and seasonal content ideas
44
+ """
45
+ current_month = datetime.now().strftime("%B")
46
+ current_year = datetime.now().year
47
+
48
+ prompt = f"""
49
+ As a real estate marketing expert, provide current trends and seasonal opportunities for {current_month} {current_year}.
50
+ Include:
51
+ 1. Current market trends
52
+ 2. Seasonal real estate topics
53
+ 3. Popular hashtags
54
+ 4. Trending video formats
55
+ 5. Local market opportunities
56
+
57
+ Focus on what's working NOW in real estate video marketing.
58
+ """
59
+
60
  try:
61
+ response = client.chat.completions.create(
62
+ model="gpt-4",
63
+ messages=[
64
+ {"role": "system", "content": "You are a real estate marketing expert with deep knowledge of current trends and seasonal opportunities."},
65
+ {"role": "user", "content": prompt}
66
+ ]
67
+ )
68
+ return response.choices[0].message.content
 
 
 
 
 
69
  except Exception as e:
70
+ return f"Unable to fetch current trends: {str(e)}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
+ def generate_content_calendar(realtor_info, market_area, specialties, target_audience, brand_style, current_trends):
73
+ """
74
+ Generates a comprehensive 30-day video content calendar for realtors
75
+ """
76
+
77
+ calendar_prompt = f"""
78
+ Create a detailed 30-day video content calendar for a realtor with these details:
79
+
80
+ Realtor Information: {realtor_info}
81
+ Market Area: {market_area}
82
+ Specialties: {specialties}
83
+ Target Audience: {target_audience}
84
+ Brand Style: {brand_style}
85
+ Current Trends: {current_trends}
86
+
87
+ For each day (1-30), provide:
88
+
89
+ **Day X: [Video Title]**
90
+ - **Content Type**: [Educational/Behind-the-scenes/Market Update/Client Testimonial/Property Showcase/etc.]
91
+ - **Platform**: [Primary platform - YouTube/Instagram/TikTok/Facebook]
92
+ - **Duration**: [Recommended length]
93
+ - **Hook**: [Opening line to grab attention]
94
+ - **Key Points**: [3-4 main talking points]
95
+ - **Call-to-Action**: [Specific action for viewers]
96
+ - **Hashtags**: [5-8 relevant hashtags]
97
+ - **Equipment Needed**: [Phone/Professional camera/Drone/etc.]
98
+ - **Location**: [Office/Property/Neighborhood/Home/etc.]
99
+
100
+ **Weekly Themes:**
101
+ - Week 1: Market Education & Expertise
102
+ - Week 2: Behind the Scenes & Personal Brand
103
+ - Week 3: Client Success Stories & Social Proof
104
+ - Week 4: Market Updates & Future Trends
105
+ - Days 29-30: Month Recap & Next Month Preview
106
+
107
+ **Content Mix Guidelines:**
108
+ - 40% Educational content
109
+ - 25% Property showcases and market updates
110
+ - 20% Behind-the-scenes and personal branding
111
+ - 15% Client testimonials and success stories
112
+
113
+ Make each video idea specific, actionable, and designed to establish the realtor as a local market expert while building trust and generating leads.
114
+
115
+ Include seasonal relevance and current market conditions in the content suggestions.
116
+ """
117
+
118
  try:
119
  response = client.chat.completions.create(
120
+ model="gpt-4",
121
  messages=[
122
+ {"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."},
123
+ {"role": "user", "content": calendar_prompt}
124
+ ]
 
 
125
  )
126
  return response.choices[0].message.content
127
  except Exception as e:
128
+ return f"Error generating calendar: {str(e)}. Please check your OpenAI API key and try again."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
+ def generate_bonus_resources(market_area, specialties):
131
+ """
132
+ Generates bonus resources including templates and scripts
133
+ """
134
+
135
+ resources_prompt = f"""
136
+ Create bonus resources for a realtor in {market_area} specializing in {specialties}:
137
+
138
+ 1. **5 Video Script Templates** (with fill-in-the-blank sections)
139
+ 2. **10 Engaging Video Hooks** for different content types
140
+ 3. **Social Media Posting Schedule** with optimal times
141
+ 4. **Video SEO Keywords** for their market area
142
+ 5. **Equipment Recommendations** by budget level
143
+ 6. **Trending Audio/Music Suggestions** for each platform
144
+
145
+ Make everything specific to real estate video marketing and lead generation.
146
+ """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
 
148
  try:
149
  response = client.chat.completions.create(
150
  model="gpt-4",
151
  messages=[
152
+ {"role": "system", "content": "You are a real estate marketing expert specializing in video content creation and lead generation strategies."},
153
+ {"role": "user", "content": resources_prompt}
154
+ ]
 
 
155
  )
156
  return response.choices[0].message.content
157
  except Exception as e:
158
+ return f"Error generating resources: {str(e)}"
 
159
 
160
+ # Streamlit setup
161
+ st.set_page_config(page_title="Realtor Video Content Calendar", layout="wide")
 
162
 
163
+ # Initialize session state
164
+ if "calendar_content" not in st.session_state:
165
+ st.session_state["calendar_content"] = None
166
+ if "bonus_resources" not in st.session_state:
167
+ st.session_state["bonus_resources"] = None
168
+ if "show_notice" not in st.session_state:
169
+ st.session_state["show_notice"] = False
170
 
171
+ # Header
172
+ st.markdown("<h1 style='text-align: center; color: #2E4057;'>πŸŽ₯ 30-Day Video Content Calendar for Realtors</h1>", unsafe_allow_html=True)
173
+ st.markdown("<h3 style='text-align: center; color: #666;'>Generate More Leads Through Strategic Video Marketing</h3>", unsafe_allow_html=True)
 
174
 
175
+ # Create two columns for input
176
+ col1, col2 = st.columns(2)
177
+
178
+ with col1:
179
+ st.markdown("### πŸ“‹ Realtor Information")
180
+ realtor_name = st.text_input("Realtor Name", placeholder="John Smith")
181
+ brokerage = st.text_input("Brokerage", placeholder="ABC Realty")
182
+ years_experience = st.number_input("Years in Real Estate", min_value=0, max_value=50, value=5)
183
 
184
+ st.markdown("### 🎯 Target Market")
185
+ market_area = st.text_input("Primary Market Area", placeholder="Downtown Austin, TX")
186
+ specialties = st.multiselect(
187
+ "Specialties",
188
+ ["First-time Homebuyers", "Luxury Properties", "Investment Properties",
189
+ "Commercial Real Estate", "Relocation Services", "Senior Housing",
190
+ "New Construction", "Foreclosures/REO", "Land/Lots"]
191
+ )
192
+
193
+ with col2:
194
+ st.markdown("### πŸ‘₯ Audience & Style")
195
+ target_audience = st.selectbox(
196
+ "Primary Target Audience",
197
+ ["First-time Homebuyers (25-35)", "Move-up Buyers (35-45)", "Luxury Buyers (45+)",
198
+ "Investors", "Empty Nesters", "Young Families", "Millennials", "Gen Z"]
199
+ )
200
+
201
+ brand_style = st.selectbox(
202
+ "Brand Personality",
203
+ ["Professional & Trustworthy", "Fun & Energetic", "Luxury & Sophisticated",
204
+ "Down-to-earth & Relatable", "Tech-savvy & Modern", "Community-focused"]
205
+ )
206
+
207
+ video_experience = st.selectbox(
208
+ "Video Creation Experience",
209
+ ["Beginner (just starting)", "Intermediate (some experience)",
210
+ "Advanced (regular creator)"]
211
+ )
212
+
213
+ # Additional preferences
214
+ st.markdown("### βš™οΈ Content Preferences")
215
+ col3, col4 = st.columns(2)
216
+
217
+ with col3:
218
+ primary_platforms = st.multiselect(
219
+ "Primary Social Media Platforms",
220
+ ["Instagram", "TikTok", "YouTube", "Facebook", "LinkedIn"],
221
+ default=["Instagram", "YouTube"]
222
+ )
223
+
224
+ with col4:
225
+ content_focus = st.multiselect(
226
+ "Content Focus Areas",
227
+ ["Market Education", "Property Tours", "Neighborhood Spotlights",
228
+ "Home Buying/Selling Tips", "Market Updates", "Personal Branding",
229
+ "Client Success Stories", "Behind-the-scenes"],
230
+ default=["Market Education", "Property Tours", "Home Buying/Selling Tips"]
231
+ )
232
+
233
+ # Contact Information Form
234
+ st.markdown("---")
235
+ st.markdown("### πŸ“ž Get Your Free 30-Day Video Calendar")
236
+ st.markdown("*Complete the form below to receive your personalized video content strategy:*")
237
+
238
+ # Render the GoHighLevel form
239
+ render_ghl_form()
240
+
241
+ # Simple generate button that doesn't require form validation
242
+ # Since the GHL form handles contact capture
243
+ generate_button = st.button('πŸš€ Generate My 30-Day Video Calendar', type="primary")
244
+
245
+ # Process results on button click
246
+ if generate_button:
247
+ # Validate required fields for calendar generation
248
+ if not realtor_name or not market_area:
249
+ st.error("Please fill in at least the Realtor Name and Primary Market Area to generate your calendar.")
250
+ else:
251
+ st.session_state["show_notice"] = True
252
 
253
+ with st.spinner("πŸ” Researching current market trends and generating your personalized video calendar..."):
254
+ # Compile realtor information
255
+ specialties_str = ", ".join(specialties) if specialties else "General Real Estate"
256
+ platforms_str = ", ".join(primary_platforms) if primary_platforms else "All platforms"
257
+ focus_str = ", ".join(content_focus) if content_focus else "General content"
258
+
259
+ 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}"
260
+
261
+ # Get current trends
262
+ current_trends = search_current_trends()
263
+
264
+ # Generate the calendar
265
+ st.session_state["calendar_content"] = generate_content_calendar(
266
+ realtor_info, market_area, specialties_str, target_audience, brand_style, current_trends
267
+ )
268
+
269
+ # Generate bonus resources
270
+ st.session_state["bonus_resources"] = generate_bonus_resources(market_area, specialties_str)
271
+
272
+ st.session_state["show_notice"] = False
273
+ st.success(f"βœ… Your personalized video calendar has been generated! Please complete the contact form above to access additional resources.")
274
+
275
+ # Display the waiting notice
276
+ if st.session_state["show_notice"]:
277
+ st.info("🎬 Creating your personalized 30-day video content calendar... This may take 1-2 minutes.")
278
+
279
+ # Display results
280
+ if st.session_state["calendar_content"]:
281
+ st.markdown("---")
282
+ st.markdown("<h2 style='text-align: center; color: #2E4057;'>πŸ“… Your 30-Day Video Content Calendar</h2>", unsafe_allow_html=True)
283
 
284
+ # Create tabs for better organization
285
+ tab1, tab2 = st.tabs(["πŸ“‹ Content Calendar", "🎁 Bonus Resources"])
 
286
 
287
+ with tab1:
288
+ st.markdown(st.session_state["calendar_content"])
 
 
 
 
289
 
290
+ # Download option
291
+ st.download_button(
292
+ label="πŸ“₯ Download Calendar as Text File",
293
+ data=st.session_state["calendar_content"],
294
+ file_name=f"30_day_video_calendar_{datetime.now().strftime('%Y%m%d')}.txt",
295
+ mime="text/plain"
296
  )
297
 
298
+ with tab2:
299
+ if st.session_state["bonus_resources"]:
300
+ st.markdown(st.session_state["bonus_resources"])
301
+
302
+ # Download option for resources
303
+ st.download_button(
304
+ label="πŸ“₯ Download Resources as Text File",
305
+ data=st.session_state["bonus_resources"],
306
+ file_name=f"video_marketing_resources_{datetime.now().strftime('%Y%m%d')}.txt",
307
+ mime="text/plain"
308
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
309
 
310
+ # Footer with loan originator value proposition
311
  st.markdown("---")
312
+ st.markdown("""
313
+ <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);'>
314
+ <h2 style='color: #1f2937; text-align: center; margin-bottom: 20px;'>🏑 Powered by Western Pioneer Financial</h2>
315
+ <div style='text-align: center; margin-bottom: 20px;'>
316
+ <h3 style='color: #1f2937; margin-bottom: 10px;'>Marcus Cavazos - Loan Originator</h3>
317
+ <p style='font-size: 16px; margin-bottom: 15px; color: #6b7280;'>
318
+ πŸ“§ <strong style='color: #1f2937;'>mcavazos@wpfloans.com</strong> | 🏦 <strong style='color: #1f2937;'>NMLS#1938369</strong>
319
+ </p>
320
+ </div>
321
 
322
+ <div style='background-color: #f9fafb; padding: 20px; border-radius: 8px; margin-bottom: 20px; border: 1px solid #e5e7eb;'>
323
+ <h4 style='color: #1f2937; text-align: center; margin-bottom: 15px;'>🀝 Partnership That Grows Your Business</h4>
324
+ <p style='text-align: center; font-size: 16px; line-height: 1.6; color: #374151;'>
325
+ This free video marketing tool is just one way I support realtors in building their business.
326
+ When your clients need financing, I provide the exceptional loan services that help you close more deals faster.
327
+ </p>
328
+ </div>
329
 
330
+ <div style='display: flex; justify-content: space-around; flex-wrap: wrap; margin: 20px 0;'>
331
+ <div style='text-align: center; margin: 10px;'>
332
+ <h4 style='color: #1f2937;'>⚑ Fast Pre-Approvals</h4>
333
+ <p style='margin: 5px 0; color: #6b7280;'>Same-day pre-approval letters</p>
334
+ </div>
335
+ <div style='text-align: center; margin: 10px;'>
336
+ <h4 style='color: #1f2937;'>πŸ† Competitive Rates</h4>
337
+ <p style='margin: 5px 0; color: #6b7280;'>Best rates for your clients</p>
338
+ </div>
339
+ <div style='text-align: center; margin: 10px;'>
340
+ <h4 style='color: #1f2937;'>πŸ“ž Direct Communication</h4>
341
+ <p style='margin: 5px 0; color: #6b7280;'>Always available for updates</p>
342
+ </div>
343
+ </div>
344
 
345
+ <div style='text-align: center; margin-top: 20px;'>
346
+ <p style='font-size: 18px; font-weight: bold; color: #1f2937;'>
347
+ Ready to partner with a loan originator who invests in your success?
348
+ </p>
349
+ <p style='font-size: 16px; margin-top: 10px; color: #374151;'>
350
+ Contact me today to discuss how we can work together to close more deals.
351
+ </p>
352
+ </div>
353
 
354
+ <div style='text-align: center; font-size: 12px; margin-top: 20px; color: #9ca3af;'>
355
+ Western Pioneer Financial | NMLS#1938369 | Equal Housing Opportunity Lender
356
+ </div>
357
+ </div>
358
+ """, unsafe_allow_html=True)