nniehaus commited on
Commit
ae1693c
·
verified ·
1 Parent(s): 29a733a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +114 -111
app.py CHANGED
@@ -1,54 +1,56 @@
1
  import streamlit as st
2
  import requests
3
  import os
4
- from datetime import datetime
 
5
 
6
  # Configure DeepSeek
7
  DEEPSEEK_API_KEY = os.getenv("DEEPSEEK_API_KEY")
8
  DEEPSEEK_ENDPOINT = "https://api.deepseek.com/v1/chat/completions"
9
 
10
- FUNNEL_STAGES = {
11
- "Awareness": {
12
- "examples": ["Educational content", "Problem-awareness", "Trend discussions"],
13
- "channels": ["YouTube", "Facebook", "TikTok", "Instagram Reels"]
14
- },
15
- "Consideration": {
16
- "examples": ["Product demos", "Comparison videos", "Testimonials"],
17
- "channels": ["LinkedIn", "Email campaigns", "YouTube Ads"]
18
- },
19
- "Conversion": {
20
- "examples": ["Limited-time offers", "Case studies", "Live Q&A sessions"],
21
- "channels": ["Website landing pages", "Retargeting ads", "SMS campaigns"]
22
- },
23
- "Retention": {
24
- "examples": ["Customer success stories", "Loyalty programs", "Product updates"],
25
- "channels": ["Email sequences", "Private Facebook groups", "Mobile app notifications"]
26
- }
27
- }
28
 
29
- def generate_marketing_plan(business_details, customer_profile):
30
- """Generate complete video marketing plan using DeepSeek"""
31
- prompt = f"""Create a detailed video marketing funnel plan for:
32
-
33
- Business Details:
34
- - Name: {business_details['name']}
35
- - Industry: {business_details['industry']}
36
- - Unique Value Proposition: {business_details['uvp']}
37
-
38
- Target Customer:
39
- - Demographics: {customer_profile['demographics']}
40
- - Main Challenges: {customer_profile['challenges']}
41
- - Preferred Content Types: {customer_profile['content_prefs']}
42
-
43
- Create a 12-month plan including:
44
- 1. 3 video ideas for each funnel stage (Awareness, Consideration, Conversion, Retention)
45
- 2. Script outline for top 2 Awareness videos
46
- 3. Promotion strategies for each stage
47
- 4. Lead magnet ideas aligned with each video
48
- 5. Recommended tools/software
49
- 6. Key performance metrics to track
50
-
51
- Format with markdown headers and bullet points."""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  headers = {
54
  "Authorization": f"Bearer {DEEPSEEK_API_KEY}",
@@ -58,7 +60,7 @@ def generate_marketing_plan(business_details, customer_profile):
58
  data = {
59
  "model": "deepseek-chat",
60
  "messages": [
61
- {"role": "system", "content": "You are a video marketing expert specializing in creating conversion funnels for small businesses."},
62
  {"role": "user", "content": prompt}
63
  ],
64
  "temperature": 0.7,
@@ -73,77 +75,78 @@ def generate_marketing_plan(business_details, customer_profile):
73
  st.error(f"API Error: {str(e)}")
74
  return None
75
 
76
- # Streamlit UI (same as before)
77
- st.set_page_config(page_title="Video Funnel Builder", layout="wide")
78
- st.title("🎥 AI Video Marketing Funnel Builder")
79
- st.markdown("### Transform viewers into customers with strategic video content")
80
 
81
- with st.expander("🚀 Start Here - Enter Business Details", expanded=True):
82
- col1, col2 = st.columns(2)
83
-
84
- with col1:
85
- business_details = {
86
- "name": st.text_input("Business Name", "The Urban Bakery"),
87
- "industry": st.selectbox("Industry", ["Food & Beverage", "Retail", "Services", "E-commerce", "Other"]),
88
- "uvp": st.text_area("Unique Value Proposition", "Artisan breads using 100-year-old sourdough starters")
89
- }
 
 
 
 
 
 
 
 
 
 
 
90
 
91
- with col2:
92
- customer_profile = {
93
- "demographics": st.text_input("Target Customer Demographics", "Ages 25-45, urban professionals, health-conscious"),
94
- "challenges": st.text_input("Their Main Challenges", "Finding time to cook healthy meals, wanting premium quality"),
95
- "content_prefs": st.multiselect("Their Preferred Content Types",
96
- ["How-to Guides", "Behind-the-Scenes", "Testimonials", "Live Videos"],
97
- default=["How-to Guides", "Behind-the-Scenes"])
98
- }
 
 
 
 
 
 
 
 
99
 
100
- if st.button("Generate Video Marketing Plan"):
101
- with st.spinner("Creating your custom 12-month video strategy..."):
102
- plan = generate_marketing_plan(business_details, customer_profile)
103
-
104
- if plan:
105
- st.success("✅ Your AI-Generated Video Marketing Plan")
106
- with st.expander("📘 Full Plan Overview", expanded=True):
107
- st.markdown(plan)
108
-
109
- # Rest of the UI components remain the same
110
- st.subheader("🎯 Stage-by-Stage Breakdown")
111
-
112
- for stage in FUNNEL_STAGES:
113
- with st.expander(f"{stage} Stage Strategy"):
114
- col_a, col_b = st.columns([1,2])
115
-
116
- with col_a:
117
- st.markdown(f"**Top Video Ideas**")
118
- for example in FUNNEL_STAGES[stage]["examples"][:3]:
119
- st.write(f"- {example}")
120
-
121
- st.markdown(f"\n**Best Promotion Channels**")
122
- for channel in FUNNEL_STAGES[stage]["channels"][:3]:
123
- st.write(f"- {channel}")
124
-
125
- with col_b:
126
- st.markdown("**Sample Lead Magnets**")
127
- lead_magnets = {
128
- "Awareness": ["Free ebook", "Industry report", "Checklist"],
129
- "Consideration": ["Webinar invite", "Product samples", "Comparison guide"],
130
- "Conversion": ["Discount code", "Free trial", "Consultation offer"],
131
- "Retention": ["Loyalty program", "Exclusive content", "Early access"]
132
- }
133
- for magnet in lead_magnets[stage]:
134
- st.write(f"- {magnet}")
135
-
136
- st.markdown("---")
137
- st.subheader("📚 Recommended Resources")
138
- st.write("""
139
- - **Free Video Editing Tools**: CapCut, Canva Video
140
- - **Analytics Tools**: Google Analytics, VidIQ
141
- - **Content Calendar Template**: [Download Here]
142
- - **Lighting Equipment Guide**: [View Recommendations]
143
- """)
144
 
145
  st.markdown("---")
146
  st.markdown("""
147
- *This AI-powered tool creates customized video marketing strategies. \
148
- Always validate recommendations with your specific business context.*
149
- """)
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
  import requests
3
  import os
4
+ from bs4 import BeautifulSoup
5
+ from urllib.parse import urljoin
6
 
7
  # Configure DeepSeek
8
  DEEPSEEK_API_KEY = os.getenv("DEEPSEEK_API_KEY")
9
  DEEPSEEK_ENDPOINT = "https://api.deepseek.com/v1/chat/completions"
10
 
11
+ def scrape_website(url, max_pages=3):
12
+ """Scrapes content from the given website URL."""
13
+ if not url.startswith("http"):
14
+ url = f"https://{url}"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
+ try:
17
+ response = requests.get(url, timeout=10)
18
+ response.raise_for_status()
19
+ soup = BeautifulSoup(response.content, "html.parser")
20
+
21
+ # Extract meaningful content
22
+ content = []
23
+
24
+ # Get meta description
25
+ meta_description = soup.find("meta", {"name": "description"})
26
+ if meta_description and meta_description.get("content"):
27
+ content.append(meta_description["content"])
28
+
29
+ # Get main content
30
+ for tag in ['h1', 'h2', 'p']:
31
+ elements = soup.find_all(tag)
32
+ content.extend([elem.get_text(strip=True) for elem in elements if elem.get_text(strip=True)])
33
+
34
+ return " ".join(content[:1500]) # Limit content length
35
+ except Exception as e:
36
+ st.error(f"Error scraping website: {str(e)}")
37
+ return None
38
+
39
+ def generate_marketing_plan(business_info):
40
+ """Generate video marketing plan using DeepSeek"""
41
+ prompt = f"""Create a detailed video marketing funnel plan based on this business information:
42
+
43
+ {business_info}
44
+
45
+ Create a 12-month video marketing plan including:
46
+ 1. Key video content themes for different stages of the customer journey
47
+ 2. Script outlines for 3 high-impact awareness videos
48
+ 3. Content distribution strategy
49
+ 4. Lead magnet suggestions for each video type
50
+ 5. Recommended tools and platforms
51
+ 6. KPIs to track
52
+
53
+ Format with markdown headers and bullet points."""
54
 
55
  headers = {
56
  "Authorization": f"Bearer {DEEPSEEK_API_KEY}",
 
60
  data = {
61
  "model": "deepseek-chat",
62
  "messages": [
63
+ {"role": "system", "content": "You are a video marketing expert specializing in creating conversion funnels for businesses."},
64
  {"role": "user", "content": prompt}
65
  ],
66
  "temperature": 0.7,
 
75
  st.error(f"API Error: {str(e)}")
76
  return None
77
 
78
+ # Streamlit UI
79
+ st.set_page_config(page_title="Video Marketing Plan Generator", layout="wide")
80
+ st.title("🎥 AI Video Marketing Plan Generator")
81
+ st.markdown("### Get a customized video marketing strategy for your business")
82
 
83
+ # Input method selection
84
+ input_method = st.radio(
85
+ "Choose input method:",
86
+ ["Enter business details manually", "Use website URL"]
87
+ )
88
+
89
+ if input_method == "Enter business details manually":
90
+ business_name = st.text_input("Business Name*")
91
+ business_description = st.text_area(
92
+ "What does your company do?*",
93
+ help="Describe your products/services and what makes you unique"
94
+ )
95
+ ideal_client = st.text_area(
96
+ "Describe your ideal client*",
97
+ help="Include demographics, challenges they face, and why they need your solution"
98
+ )
99
+ current_marketing = st.text_area(
100
+ "Current marketing efforts (optional)",
101
+ help="What marketing strategies are you currently using? What's working/not working?"
102
+ )
103
 
104
+ if st.button("Generate Marketing Plan"):
105
+ if not all([business_name, business_description, ideal_client]):
106
+ st.error("Please fill in all required fields marked with *")
107
+ else:
108
+ with st.spinner("Creating your custom video marketing strategy..."):
109
+ business_info = f"""
110
+ Business Name: {business_name}
111
+ Business Description: {business_description}
112
+ Ideal Client Profile: {ideal_client}
113
+ Current Marketing: {current_marketing if current_marketing else 'Not provided'}
114
+ """
115
+
116
+ plan = generate_marketing_plan(business_info)
117
+ if plan:
118
+ st.success("✅ Your AI-Generated Video Marketing Plan")
119
+ st.markdown(plan)
120
 
121
+ else:
122
+ website_url = st.text_input(
123
+ "Enter your website URL*",
124
+ placeholder="e.g., www.example.com"
125
+ )
126
+
127
+ if st.button("Generate Marketing Plan"):
128
+ if not website_url:
129
+ st.error("Please enter your website URL")
130
+ else:
131
+ with st.spinner("Analyzing your website and creating your marketing strategy..."):
132
+ website_content = scrape_website(website_url)
133
+ if website_content:
134
+ plan = generate_marketing_plan(website_content)
135
+ if plan:
136
+ st.success("✅ Your AI-Generated Video Marketing Plan")
137
+ st.markdown(plan)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
 
139
  st.markdown("---")
140
  st.markdown("""
141
+ *Want to implement this strategy with expert guidance? [Schedule a free consultation →](your-calendly-link)*
142
+ """)
143
+
144
+ # Add contact form
145
+ with st.expander("💡 Get more marketing insights"):
146
+ st.markdown("Leave your contact information to receive weekly video marketing tips and updates")
147
+ contact_email = st.text_input("Email Address")
148
+ if st.button("Subscribe"):
149
+ if contact_email:
150
+ st.success("Thanks for subscribing! Check your inbox for a welcome message.")
151
+ else:
152
+ st.error("Please enter your email address")