Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
CHANGED
|
@@ -1,521 +1,491 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
|
| 3 |
-
|
| 4 |
import requests
|
|
|
|
|
|
|
|
|
|
| 5 |
import os
|
| 6 |
-
|
| 7 |
-
from
|
| 8 |
-
from urllib.parse import urlparse
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
st.info("Attempting to wake up the tool...")
|
| 19 |
try:
|
| 20 |
-
#
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
except Exception as e:
|
| 27 |
-
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
def
|
| 38 |
-
"""
|
| 39 |
-
|
| 40 |
-
url = f"https://{url}"
|
| 41 |
try:
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
except Exception as e:
|
|
|
|
| 56 |
return None
|
| 57 |
|
| 58 |
-
def
|
| 59 |
-
"""
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
|
| 63 |
|
| 64 |
-
|
| 65 |
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
- Geographic markets served
|
| 75 |
-
- Customer pain points they address
|
| 76 |
-
- Market positioning
|
| 77 |
|
| 78 |
-
|
| 79 |
-
- Social media presence and activity
|
| 80 |
-
- Content marketing efforts
|
| 81 |
-
- SEO visibility and digital footprint
|
| 82 |
-
- Customer reviews and reputation
|
| 83 |
|
| 84 |
-
|
| 85 |
-
- Main competitors in their space
|
| 86 |
-
- Unique selling propositions
|
| 87 |
-
- Market differentiation factors
|
| 88 |
-
- Industry trends affecting them
|
| 89 |
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
- Challenges they likely face
|
| 95 |
|
| 96 |
-
|
| 97 |
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 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 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 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 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 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 |
-
#
|
| 347 |
-
st.
|
| 348 |
-
st.markdown("### Generate a comprehensive, actionable video marketing funnel for your business")
|
| 349 |
|
| 350 |
-
|
| 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 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 357 |
|
| 358 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
col1, col2 = st.columns(2)
|
| 360 |
|
| 361 |
with col1:
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 369 |
with col2:
|
| 370 |
-
|
| 371 |
-
"
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
|
|
|
| 380 |
|
| 381 |
-
|
| 382 |
-
st.markdown("**Additional Context (Optional)**")
|
| 383 |
-
col3, col4 = st.columns(2)
|
| 384 |
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
)
|
| 398 |
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
| 402 |
-
|
| 403 |
-
|
| 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 |
-
|
| 435 |
-
|
| 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 requests
|
| 4 |
+
from PIL import Image
|
| 5 |
+
import io
|
| 6 |
+
import base64
|
| 7 |
import os
|
| 8 |
+
import json
|
| 9 |
+
from datetime import datetime
|
|
|
|
| 10 |
|
| 11 |
+
# Initialize OpenAI client
|
| 12 |
+
client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
| 13 |
|
| 14 |
+
def encode_image_to_base64(image):
|
| 15 |
+
"""Convert PIL image to base64 string for API calls"""
|
| 16 |
+
buffer = io.BytesIO()
|
| 17 |
+
image.save(buffer, format="PNG")
|
| 18 |
+
img_str = base64.b64encode(buffer.getvalue()).decode()
|
| 19 |
+
return img_str
|
| 20 |
|
| 21 |
+
def search_current_landscaping_trends():
|
| 22 |
+
"""Use web search to get current landscaping and outdoor design trends"""
|
|
|
|
| 23 |
try:
|
| 24 |
+
# In a real implementation, this would use the built-in web search capabilities
|
| 25 |
+
# For now, we'll create a comprehensive knowledge base
|
| 26 |
+
current_trends = """
|
| 27 |
+
Current 2025 landscaping and backyard design trends include:
|
| 28 |
+
- Sustainable and native plant gardens
|
| 29 |
+
- Outdoor living rooms with weather-resistant furniture
|
| 30 |
+
- Multi-functional spaces for work and relaxation
|
| 31 |
+
- Smart irrigation and lighting systems
|
| 32 |
+
- Vertical gardens and living walls
|
| 33 |
+
- Fire features as focal points
|
| 34 |
+
- Natural swimming pools and water features
|
| 35 |
+
- Outdoor kitchens with pizza ovens
|
| 36 |
+
- Pergolas with retractable canopies
|
| 37 |
+
- Drought-resistant xeriscaping
|
| 38 |
+
- Edible landscaping with herb gardens
|
| 39 |
+
- Wellness spaces for meditation and yoga
|
| 40 |
+
"""
|
| 41 |
+
return current_trends
|
| 42 |
except Exception as e:
|
| 43 |
+
return "Current outdoor design trends focus on sustainability, functionality, and wellness."
|
| 44 |
|
| 45 |
+
def generate_design_prompt(user_preferences, current_trends):
|
| 46 |
+
"""Create a detailed prompt for the AI based on user preferences and current trends"""
|
| 47 |
+
|
| 48 |
+
features_text = ", ".join(user_preferences['features']) if user_preferences['features'] else "basic landscaping"
|
| 49 |
+
|
| 50 |
+
prompt = f"""
|
| 51 |
+
Create a detailed, professional backyard oasis design description based on these specifications:
|
| 52 |
+
|
| 53 |
+
DESIGN REQUIREMENTS:
|
| 54 |
+
- Style: {user_preferences['style']}
|
| 55 |
+
- Primary Use: {user_preferences['primary_use']}
|
| 56 |
+
- Budget Range: {user_preferences['budget']}
|
| 57 |
+
- Must-Have Features: {features_text}
|
| 58 |
+
- Seating Arrangement: {user_preferences['seating']}
|
| 59 |
+
- Plant Preferences: {user_preferences['plants']}
|
| 60 |
+
- Privacy Level: {user_preferences['privacy']}/5
|
| 61 |
+
- Maintenance Level: {user_preferences['maintenance']}/5
|
| 62 |
+
- Lighting Style: {user_preferences['lighting']}
|
| 63 |
+
- Climate Zone: {user_preferences['climate']}
|
| 64 |
+
|
| 65 |
+
CURRENT TRENDS TO INCORPORATE:
|
| 66 |
+
{current_trends}
|
| 67 |
+
|
| 68 |
+
Please provide:
|
| 69 |
+
1. **Design Overview**: A compelling description of the overall backyard transformation
|
| 70 |
+
2. **Layout Plan**: Detailed spatial arrangement of all elements
|
| 71 |
+
3. **Plant Selection**: Specific plants suited to the climate and maintenance level
|
| 72 |
+
4. **Material Recommendations**: Specific materials for hardscaping, furniture, and structures
|
| 73 |
+
5. **Feature Integration**: How each requested feature will be incorporated
|
| 74 |
+
6. **Lighting Design**: Complete lighting strategy for ambiance and functionality
|
| 75 |
+
7. **Maintenance Schedule**: Seasonal care requirements
|
| 76 |
+
8. **Implementation Timeline**: Phased approach with estimated timeframes
|
| 77 |
+
9. **Cost Breakdown**: Detailed budget allocation by category
|
| 78 |
+
10. **Professional Tips**: Expert advice for maximizing the space and achieving goals
|
| 79 |
+
|
| 80 |
+
Make this a comprehensive, actionable design plan that a homeowner could use to create their dream backyard.
|
| 81 |
+
"""
|
| 82 |
+
|
| 83 |
+
return prompt
|
| 84 |
|
| 85 |
+
def generate_backyard_design(user_preferences, image_description=None):
|
| 86 |
+
"""Generate a comprehensive backyard design using OpenAI"""
|
| 87 |
+
|
| 88 |
+
try:
|
| 89 |
+
# Get current trends
|
| 90 |
+
current_trends = search_current_landscaping_trends()
|
| 91 |
+
|
| 92 |
+
# Create the design prompt
|
| 93 |
+
design_prompt = generate_design_prompt(user_preferences, current_trends)
|
| 94 |
+
|
| 95 |
+
# Add image context if provided
|
| 96 |
+
if image_description:
|
| 97 |
+
design_prompt = f"""
|
| 98 |
+
CURRENT YARD ANALYSIS: {image_description}
|
| 99 |
+
|
| 100 |
+
{design_prompt}
|
| 101 |
+
|
| 102 |
+
Please incorporate the existing yard features and work with the current space limitations and opportunities.
|
| 103 |
+
"""
|
| 104 |
+
|
| 105 |
+
messages = [
|
| 106 |
+
{
|
| 107 |
+
"role": "system",
|
| 108 |
+
"content": """You are a world-class landscape architect and outdoor design expert trained by the best designers in the field.
|
| 109 |
+
Your expertise includes sustainable design, modern outdoor living, plant selection, hardscaping, and creating functional beautiful spaces.
|
| 110 |
+
|
| 111 |
+
Create highly detailed, actionable backyard designs that are:
|
| 112 |
+
- Specific to the user's climate and preferences
|
| 113 |
+
- Realistic within their stated budget
|
| 114 |
+
- Incorporating current design trends and sustainable practices
|
| 115 |
+
- Providing exact plant names, material specifications, and implementation steps
|
| 116 |
+
- Including maintenance requirements and seasonal care
|
| 117 |
+
- Offering creative solutions for common backyard challenges
|
| 118 |
+
|
| 119 |
+
Always provide comprehensive, professional-quality designs that could be used by contractors and landscapers."""
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"role": "user",
|
| 123 |
+
"content": design_prompt
|
| 124 |
+
}
|
| 125 |
+
]
|
| 126 |
+
|
| 127 |
+
response = client.chat.completions.create(
|
| 128 |
+
model="gpt-4",
|
| 129 |
+
messages=messages,
|
| 130 |
+
max_tokens=3000,
|
| 131 |
+
temperature=0.7
|
| 132 |
+
)
|
| 133 |
+
|
| 134 |
+
return response.choices[0].message.content
|
| 135 |
+
|
| 136 |
+
except Exception as e:
|
| 137 |
+
st.error(f"Error generating design: {str(e)}")
|
| 138 |
+
return None
|
| 139 |
|
| 140 |
+
def analyze_yard_image(image):
|
| 141 |
+
"""Analyze the uploaded yard image using OpenAI Vision"""
|
| 142 |
+
|
|
|
|
| 143 |
try:
|
| 144 |
+
# Convert image to base64
|
| 145 |
+
img_base64 = encode_image_to_base64(image)
|
| 146 |
+
|
| 147 |
+
response = client.chat.completions.create(
|
| 148 |
+
model="gpt-4-vision-preview",
|
| 149 |
+
messages=[
|
| 150 |
+
{
|
| 151 |
+
"role": "user",
|
| 152 |
+
"content": [
|
| 153 |
+
{
|
| 154 |
+
"type": "text",
|
| 155 |
+
"text": """Analyze this backyard/yard image and provide a detailed description including:
|
| 156 |
+
- Current layout and size estimation
|
| 157 |
+
- Existing features (deck, patio, plants, structures)
|
| 158 |
+
- Soil and grass condition
|
| 159 |
+
- Sun/shade patterns visible
|
| 160 |
+
- Potential challenges and opportunities
|
| 161 |
+
- Existing trees and landscaping
|
| 162 |
+
- Property boundaries and neighbor considerations
|
| 163 |
+
- Overall style and condition
|
| 164 |
+
|
| 165 |
+
Be specific and detailed to help with redesign planning."""
|
| 166 |
+
},
|
| 167 |
+
{
|
| 168 |
+
"type": "image_url",
|
| 169 |
+
"image_url": {
|
| 170 |
+
"url": f"data:image/png;base64,{img_base64}"
|
| 171 |
+
}
|
| 172 |
+
}
|
| 173 |
+
]
|
| 174 |
+
}
|
| 175 |
+
],
|
| 176 |
+
max_tokens=1000
|
| 177 |
+
)
|
| 178 |
+
|
| 179 |
+
return response.choices[0].message.content
|
| 180 |
+
|
| 181 |
except Exception as e:
|
| 182 |
+
st.warning(f"Could not analyze image: {str(e)}. Proceeding without image analysis.")
|
| 183 |
return None
|
| 184 |
|
| 185 |
+
def create_lead_capture_email(user_preferences, design_content):
|
| 186 |
+
"""Create email content for lead capture"""
|
| 187 |
+
|
| 188 |
+
features_list = ", ".join(user_preferences['features']) if user_preferences['features'] else "Custom landscaping"
|
| 189 |
+
|
| 190 |
+
email_subject = "My Dream Backyard Design - VIP Property List Request"
|
| 191 |
+
|
| 192 |
+
email_body = f"""Hi there!
|
| 193 |
|
| 194 |
+
I just created my dream backyard design using your Backyard Oasis Designer tool and would love to join your VIP list for homes with great outdoor potential!
|
| 195 |
|
| 196 |
+
Here are my design preferences:
|
| 197 |
|
| 198 |
+
🏡 DESIGN SPECIFICATIONS:
|
| 199 |
+
• Style: {user_preferences['style']}
|
| 200 |
+
• Primary Use: {user_preferences['primary_use']}
|
| 201 |
+
• Budget: {user_preferences['budget']}
|
| 202 |
+
• Must-Have Features: {features_list}
|
| 203 |
+
• Seating: {user_preferences['seating']}
|
| 204 |
+
• Plants: {user_preferences['plants']}
|
| 205 |
+
• Privacy Level: {user_preferences['privacy']}/5
|
| 206 |
+
• Maintenance Level: {user_preferences['maintenance']}/5
|
| 207 |
+
• Lighting: {user_preferences['lighting']}
|
| 208 |
+
• Climate: {user_preferences['climate']}
|
| 209 |
|
| 210 |
+
GENERATED DESIGN SUMMARY:
|
| 211 |
+
{design_content[:500]}...
|
|
|
|
|
|
|
|
|
|
| 212 |
|
| 213 |
+
Please add me to your VIP list so I can be notified of homes that would work well for creating this type of outdoor space!
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
|
| 215 |
+
Looking forward to hearing from you.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
|
| 217 |
+
Best regards,
|
| 218 |
+
[Your Name]
|
| 219 |
+
[Your Phone Number]
|
| 220 |
+
[Your Email]"""
|
|
|
|
| 221 |
|
| 222 |
+
return email_subject, email_body
|
| 223 |
|
| 224 |
+
# Streamlit App Configuration
|
| 225 |
+
st.set_page_config(
|
| 226 |
+
page_title="Backyard Oasis Designer",
|
| 227 |
+
page_icon="🌿",
|
| 228 |
+
layout="wide",
|
| 229 |
+
initial_sidebar_state="collapsed"
|
| 230 |
+
)
|
| 231 |
|
| 232 |
+
# Custom CSS for better styling
|
| 233 |
+
st.markdown("""
|
| 234 |
+
<style>
|
| 235 |
+
.main-header {
|
| 236 |
+
text-align: center;
|
| 237 |
+
color: #2E7D32;
|
| 238 |
+
font-size: 3rem;
|
| 239 |
+
font-weight: bold;
|
| 240 |
+
margin-bottom: 0.5rem;
|
| 241 |
+
}
|
| 242 |
+
.sub-header {
|
| 243 |
+
text-align: center;
|
| 244 |
+
color: #4CAF50;
|
| 245 |
+
font-size: 1.2rem;
|
| 246 |
+
margin-bottom: 2rem;
|
| 247 |
+
}
|
| 248 |
+
.section-header {
|
| 249 |
+
color: #2E7D32;
|
| 250 |
+
font-size: 1.5rem;
|
| 251 |
+
font-weight: bold;
|
| 252 |
+
margin-top: 2rem;
|
| 253 |
+
margin-bottom: 1rem;
|
| 254 |
+
}
|
| 255 |
+
.feature-box {
|
| 256 |
+
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
|
| 257 |
+
padding: 1.5rem;
|
| 258 |
+
border-radius: 10px;
|
| 259 |
+
border-left: 5px solid #4CAF50;
|
| 260 |
+
margin: 1rem 0;
|
| 261 |
+
}
|
| 262 |
+
.cta-box {
|
| 263 |
+
background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
|
| 264 |
+
padding: 2rem;
|
| 265 |
+
border-radius: 15px;
|
| 266 |
+
border: 2px solid #4CAF50;
|
| 267 |
+
margin: 2rem 0;
|
| 268 |
+
text-align: center;
|
| 269 |
+
}
|
| 270 |
+
.step-number {
|
| 271 |
+
background: linear-gradient(135deg, #4CAF50, #2E7D32);
|
| 272 |
+
color: white;
|
| 273 |
+
width: 30px;
|
| 274 |
+
height: 30px;
|
| 275 |
+
border-radius: 50%;
|
| 276 |
+
display: inline-flex;
|
| 277 |
+
align-items: center;
|
| 278 |
+
justify-content: center;
|
| 279 |
+
font-weight: bold;
|
| 280 |
+
margin-right: 10px;
|
| 281 |
+
}
|
| 282 |
+
</style>
|
| 283 |
+
""", unsafe_allow_html=True)
|
| 284 |
|
| 285 |
+
# Initialize session state
|
| 286 |
+
if "design_result" not in st.session_state:
|
| 287 |
+
st.session_state["design_result"] = None
|
| 288 |
+
if "user_preferences" not in st.session_state:
|
| 289 |
+
st.session_state["user_preferences"] = {}
|
| 290 |
+
if "show_generating" not in st.session_state:
|
| 291 |
+
st.session_state["show_generating"] = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 292 |
|
| 293 |
+
# Main Header
|
| 294 |
+
st.markdown('<h1 class="main-header">🌿 Backyard Oasis Designer</h1>', unsafe_allow_html=True)
|
| 295 |
+
st.markdown('<p class="sub-header">Transform your yard into a stunning outdoor paradise with AI</p>', unsafe_allow_html=True)
|
| 296 |
+
|
| 297 |
+
# Step 1: Image Upload
|
| 298 |
+
st.markdown('<div class="section-header"><span class="step-number">1</span>Upload Your Current Yard Photo</div>', unsafe_allow_html=True)
|
| 299 |
+
|
| 300 |
+
uploaded_file = st.file_uploader(
|
| 301 |
+
"Upload a clear photo of your current backyard",
|
| 302 |
+
type=['png', 'jpg', 'jpeg'],
|
| 303 |
+
help="This helps us understand your current space and create a more personalized design"
|
| 304 |
+
)
|
| 305 |
+
|
| 306 |
+
image_analysis = None
|
| 307 |
+
if uploaded_file is not None:
|
| 308 |
+
image = Image.open(uploaded_file)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 309 |
|
| 310 |
+
col1, col2, col3 = st.columns([1, 2, 1])
|
| 311 |
+
with col2:
|
| 312 |
+
st.image(image, caption="Your Current Yard", use_column_width=True)
|
| 313 |
+
|
| 314 |
+
with st.spinner("Analyzing your yard..."):
|
| 315 |
+
image_analysis = analyze_yard_image(image)
|
| 316 |
+
|
| 317 |
+
if image_analysis:
|
| 318 |
+
with st.expander("📊 Yard Analysis"):
|
| 319 |
+
st.write(image_analysis)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 320 |
|
| 321 |
+
# Step 2: Design Preferences
|
| 322 |
+
st.markdown('<div class="section-header"><span class="step-number">2</span>Design Your Perfect Oasis</div>', unsafe_allow_html=True)
|
|
|
|
| 323 |
|
| 324 |
+
col1, col2 = st.columns(2)
|
|
|
|
| 325 |
|
| 326 |
+
with col1:
|
| 327 |
+
style = st.selectbox(
|
| 328 |
+
"What's your preferred outdoor style?",
|
| 329 |
+
["", "Modern Minimalist", "Tropical Paradise", "Zen Garden", "Rustic Farmhouse", "Mediterranean", "Desert Contemporary"],
|
| 330 |
+
help="This sets the overall aesthetic direction for your design"
|
| 331 |
+
)
|
| 332 |
+
|
| 333 |
+
primary_use = st.selectbox(
|
| 334 |
+
"What's the primary use for your backyard?",
|
| 335 |
+
["", "Entertaining & Parties", "Relaxation & Meditation", "Family Activities", "Gardening & Growing", "Outdoor Dining", "Sports & Recreation"]
|
| 336 |
+
)
|
| 337 |
+
|
| 338 |
+
budget = st.selectbox(
|
| 339 |
+
"What's your budget range?",
|
| 340 |
+
["", "Budget-Friendly ($500-2,000)", "Moderate ($2,000-10,000)", "Premium ($10,000-25,000)", "Luxury ($25,000+)"]
|
| 341 |
+
)
|
| 342 |
+
|
| 343 |
+
seating = st.selectbox(
|
| 344 |
+
"Preferred seating arrangement?",
|
| 345 |
+
["", "Lounge/Living Area", "Dining Table & Chairs", "Conversation Pit", "Built-in Benches", "Swings & Hammocks", "Mix of Different Seating"]
|
| 346 |
+
)
|
| 347 |
+
|
| 348 |
+
plants = st.selectbox(
|
| 349 |
+
"Plant preferences?",
|
| 350 |
+
["", "Low Maintenance", "Native Plants", "Tropical & Lush", "Drought Tolerant", "Seasonal Colors", "Herbs & Vegetables"]
|
| 351 |
+
)
|
| 352 |
+
|
| 353 |
+
with col2:
|
| 354 |
+
st.markdown("**Must-have features** (Select all that apply):")
|
| 355 |
+
features = []
|
| 356 |
+
|
| 357 |
+
if st.checkbox("🏊 Pool or Spa"):
|
| 358 |
+
features.append("Pool or Spa")
|
| 359 |
+
if st.checkbox("🍳 Outdoor Kitchen"):
|
| 360 |
+
features.append("Outdoor Kitchen")
|
| 361 |
+
if st.checkbox("🔥 Fire Pit/Fireplace"):
|
| 362 |
+
features.append("Fire Pit/Fireplace")
|
| 363 |
+
if st.checkbox("💧 Water Feature"):
|
| 364 |
+
features.append("Water Feature")
|
| 365 |
+
if st.checkbox("🏗️ Pergola or Gazebo"):
|
| 366 |
+
features.append("Pergola or Gazebo")
|
| 367 |
+
if st.checkbox("🌱 Flower/Vegetable Gardens"):
|
| 368 |
+
features.append("Flower/Vegetable Gardens")
|
| 369 |
+
if st.checkbox("🛝 Playground/Kids Area"):
|
| 370 |
+
features.append("Playground/Kids Area")
|
| 371 |
+
if st.checkbox("🍹 Outdoor Bar"):
|
| 372 |
+
features.append("Outdoor Bar")
|
| 373 |
+
|
| 374 |
+
privacy = st.slider("Privacy level desired:", 1, 5, 3, help="1 = Very Open, 5 = Very Private")
|
| 375 |
+
|
| 376 |
+
maintenance = st.slider("Maintenance commitment:", 1, 5, 3, help="1 = Very Low, 5 = Very High")
|
| 377 |
+
|
| 378 |
+
lighting = st.selectbox(
|
| 379 |
+
"Lighting preferences?",
|
| 380 |
+
["", "String Lights", "Landscape Lighting", "Solar Lights", "Built-in LED System", "Fire-based Lighting", "Minimal Lighting"]
|
| 381 |
+
)
|
| 382 |
+
|
| 383 |
+
climate = st.selectbox(
|
| 384 |
+
"Your climate zone?",
|
| 385 |
+
["", "Tropical", "Subtropical", "Temperate", "Arid/Desert", "Continental", "Mediterranean"]
|
| 386 |
+
)
|
| 387 |
+
|
| 388 |
+
# Form validation
|
| 389 |
+
required_fields = [style, primary_use, budget, seating, plants, lighting, climate]
|
| 390 |
+
all_filled = all(field != "" for field in required_fields)
|
| 391 |
+
has_features = len(features) > 0
|
| 392 |
+
|
| 393 |
+
if st.button("🎨 Generate My Dream Backyard", type="primary", disabled=not (all_filled and has_features)):
|
| 394 |
+
if not all_filled:
|
| 395 |
+
st.error("Please fill in all the design preferences.")
|
| 396 |
+
elif not has_features:
|
| 397 |
+
st.error("Please select at least one must-have feature.")
|
| 398 |
+
else:
|
| 399 |
+
# Store user preferences
|
| 400 |
+
st.session_state["user_preferences"] = {
|
| 401 |
+
'style': style,
|
| 402 |
+
'primary_use': primary_use,
|
| 403 |
+
'budget': budget,
|
| 404 |
+
'features': features,
|
| 405 |
+
'seating': seating,
|
| 406 |
+
'plants': plants,
|
| 407 |
+
'privacy': privacy,
|
| 408 |
+
'maintenance': maintenance,
|
| 409 |
+
'lighting': lighting,
|
| 410 |
+
'climate': climate
|
| 411 |
+
}
|
| 412 |
+
|
| 413 |
+
st.session_state["show_generating"] = True
|
| 414 |
+
|
| 415 |
+
with st.spinner("Creating your personalized backyard oasis... This may take 30-60 seconds"):
|
| 416 |
+
design_result = generate_backyard_design(st.session_state["user_preferences"], image_analysis)
|
| 417 |
+
|
| 418 |
+
if design_result:
|
| 419 |
+
st.session_state["design_result"] = design_result
|
| 420 |
+
st.session_state["show_generating"] = False
|
| 421 |
+
st.success("🎉 Your dream backyard design is ready!")
|
| 422 |
+
else:
|
| 423 |
+
st.session_state["show_generating"] = False
|
| 424 |
+
st.error("Sorry, we couldn't generate your design right now. Please try again.")
|
| 425 |
|
| 426 |
+
# Display generating notice
|
| 427 |
+
if st.session_state["show_generating"]:
|
| 428 |
+
st.info("🎨 Generating your backyard design. This process may take a minute or two. Please wait...")
|
| 429 |
+
|
| 430 |
+
# Display Results
|
| 431 |
+
if st.session_state["design_result"]:
|
| 432 |
+
st.markdown('<div class="section-header">🌟 Your Dream Backyard Design</div>', unsafe_allow_html=True)
|
| 433 |
+
|
| 434 |
+
# Display the design
|
| 435 |
+
st.markdown(st.session_state["design_result"])
|
| 436 |
+
|
| 437 |
+
# Real Estate Lead Capture CTAs
|
| 438 |
+
st.markdown('<div class="cta-box">', unsafe_allow_html=True)
|
| 439 |
+
st.markdown("### 💡 Love This Design?")
|
| 440 |
+
|
| 441 |
col1, col2 = st.columns(2)
|
| 442 |
|
| 443 |
with col1:
|
| 444 |
+
if st.button("📧 Email me this design to join my VIP list for homes with great outdoor potential", key="email_cta"):
|
| 445 |
+
email_subject, email_body = create_lead_capture_email(st.session_state["user_preferences"], st.session_state["design_result"])
|
| 446 |
+
|
| 447 |
+
# Create mailto link
|
| 448 |
+
mailto_link = f"mailto:?subject={email_subject}&body={email_body}"
|
| 449 |
+
st.markdown(f'<a href="{mailto_link}" target="_blank">Click here if email didn\'t open automatically</a>', unsafe_allow_html=True)
|
| 450 |
+
|
| 451 |
+
# Also show a form for manual copy
|
| 452 |
+
with st.expander("📋 Copy Email Content"):
|
| 453 |
+
st.text_area("Subject:", value=email_subject, height=50)
|
| 454 |
+
st.text_area("Email Body:", value=email_body, height=300)
|
| 455 |
+
|
| 456 |
with col2:
|
| 457 |
+
if st.button("🚀 Share This Tool with Friends!", key="share_cta"):
|
| 458 |
+
share_text = """🌿 Check out this amazing Backyard Oasis Designer!
|
| 459 |
+
|
| 460 |
+
Upload a photo of your yard, answer 10 questions, and get an AI-generated design of your dream outdoor space.
|
| 461 |
+
|
| 462 |
+
Perfect for anyone thinking about buying a home with outdoor potential! 🏡✨
|
| 463 |
+
|
| 464 |
+
Try it here: [Insert your website URL]"""
|
| 465 |
+
|
| 466 |
+
st.text_area("Share this message:", value=share_text, height=150)
|
| 467 |
+
st.info("Know someone who's ready to start house hunting? Send them this backyard designer to give them some great ideas!")
|
| 468 |
|
| 469 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
|
|
|
|
|
|
| 470 |
|
| 471 |
+
# Generate another design option
|
| 472 |
+
if st.button("🔄 Generate Another Design Variation", key="regenerate"):
|
| 473 |
+
with st.spinner("Creating another design variation..."):
|
| 474 |
+
new_design = generate_backyard_design(st.session_state["user_preferences"], image_analysis)
|
| 475 |
+
if new_design:
|
| 476 |
+
st.session_state["design_result"] = new_design
|
| 477 |
+
st.experimental_rerun()
|
| 478 |
+
|
| 479 |
+
# Sidebar with additional info
|
| 480 |
+
with st.sidebar:
|
| 481 |
+
st.markdown("### About This Tool")
|
| 482 |
+
st.write("This AI-powered designer creates custom backyard plans based on your preferences, budget, and climate.")
|
|
|
|
| 483 |
|
| 484 |
+
st.markdown("### Need Help?")
|
| 485 |
+
st.write("Having trouble? Make sure to:")
|
| 486 |
+
st.write("• Upload a clear photo of your yard")
|
| 487 |
+
st.write("• Fill in all preference fields")
|
| 488 |
+
st.write("• Select at least one feature")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 489 |
|
| 490 |
+
st.markdown("### Real Estate Services")
|
| 491 |
+
st.write("Looking for a home with great outdoor potential? Our VIP list gives you first access to properties perfect for your dream backyard!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|