Update app.py
Browse files
app.py
CHANGED
|
@@ -1,54 +1,56 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import requests
|
| 3 |
import os
|
| 4 |
-
from
|
|
|
|
| 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 |
-
|
| 11 |
-
"
|
| 12 |
-
|
| 13 |
-
|
| 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 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
| 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
|
| 77 |
-
st.set_page_config(page_title="Video
|
| 78 |
-
st.title("🎥 AI Video Marketing
|
| 79 |
-
st.markdown("###
|
| 80 |
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
st.
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 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 |
-
*
|
| 148 |
-
|
| 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")
|