jamierpatterson commited on
Commit
9461e13
·
verified ·
1 Parent(s): 56af34b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +122 -44
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import streamlit as st
2
- st.set_page_config(page_title="Video Marketing Plan Generator", layout="wide")
3
 
4
  import requests
5
  import os
@@ -9,8 +9,24 @@ from bs4 import BeautifulSoup
9
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
10
  OPENAI_ENDPOINT = "https://api.openai.com/v1/chat/completions"
11
 
12
- def scrape_website(url):
13
- """Scrapes business content from the given website URL."""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  if not url.startswith("http"):
15
  url = f"https://{url}"
16
 
@@ -35,20 +51,33 @@ def scrape_website(url):
35
  st.error(f"Error scraping website: {str(e)}")
36
  return None
37
 
38
- def generate_video_marketing_plan(business_info):
39
- """Generates a comprehensive video marketing plan using OpenAI GPT-4."""
40
- prompt = f"""As a leading video marketing strategist specializing in conversion optimization, create a comprehensive video marketing plan for the following business:
 
 
41
  {business_info}
42
 
43
- Your plan should include:
44
- 1. **Core Strategy:** Identify 3 unique angles or approaches that differentiate this business’s video content and showcase its unique value proposition.
45
- 2. **Funnel Architecture:** Provide detailed video content ideas for each stage of the funnel: Awareness, Consideration, Conversion, and Post-Purchase.
46
- 3. **Content Blueprints:** For the top 3 video concepts, include a content outline, key messaging points, attention-grabbing hooks, call-to-action strategy, ideal length/format, and platform-specific tips.
47
- 4. **Production Guidelines:** Recommend visual styles, music/sound design, text overlay strategies, and thumbnail design principles.
48
- 5. **Distribution Strategy:** Suggest primary platforms, posting frequency, cross-platform repurposing, hashtag/keyword recommendations, and community engagement tactics.
49
- 6. **Measurement Framework:** Define KPIs, engagement metrics, conversion tracking, and A/B testing recommendations to evaluate performance.
 
 
 
 
 
 
 
 
 
50
 
51
- Format your response in clear markdown with headers and bullet points, and explain the strategic reasoning behind each recommendation."""
 
 
52
 
53
  headers = {
54
  "Authorization": f"Bearer {OPENAI_API_KEY}",
@@ -58,11 +87,11 @@ Format your response in clear markdown with headers and bullet points, and expla
58
  data = {
59
  "model": "gpt-4", # Using OpenAI GPT-4 model
60
  "messages": [
61
- {"role": "system", "content": "You are a top-tier video marketing strategist with years of experience developing conversion-optimized video funnels."},
62
  {"role": "user", "content": prompt}
63
  ],
64
  "temperature": 0.7,
65
- "max_tokens": 4000
66
  }
67
 
68
  try:
@@ -74,41 +103,90 @@ Format your response in clear markdown with headers and bullet points, and expla
74
  return None
75
 
76
  # Streamlit UI
77
- st.title("🎥 Video Marketing Plan Generator")
78
- st.markdown("### Generate a comprehensive video marketing plan for your business.")
 
 
 
 
 
 
 
 
79
 
80
- input_method = st.radio("Choose input method:", ["Enter business details manually", "Use website URL"])
81
 
82
- if input_method == "Enter business details manually":
83
- business_name = st.text_input("Business Name*")
84
- business_description = st.text_area("What does your company do?*", help="Describe your products/services and what makes you unique.")
85
- ideal_client = st.text_area("Ideal Client Profile*", help="Include demographics, challenges they face, and why they need your solution.")
86
- marketing_goals = st.text_area("Marketing Goals (optional)", help="Describe your primary marketing objectives, target metrics, and any specific goals.")
 
 
 
 
 
 
87
 
88
- if st.button("Generate Marketing Plan"):
89
- if not all([business_name, business_description, ideal_client]):
 
 
90
  st.error("Please fill in all required fields marked with *")
91
  else:
92
- with st.spinner("Creating your custom video marketing plan..."):
93
  business_info = f"""
94
- Business Name: {business_name}
95
- Business Description: {business_description}
96
- Ideal Client Profile: {ideal_client}
97
- Marketing Goals: {marketing_goals if marketing_goals else 'Not provided'}
98
  """
99
- plan = generate_video_marketing_plan(business_info)
100
- if plan:
101
- st.markdown(plan)
 
 
 
 
 
 
 
 
 
 
 
102
  else:
103
- website_url = st.text_input("Enter your business website URL*", placeholder="e.g., www.example.com")
104
 
105
- if st.button("Generate Marketing Plan"):
106
- if not website_url:
107
- st.error("Please enter a valid website URL")
 
 
 
 
 
 
 
 
108
  else:
109
- with st.spinner("Extracting business details and generating your video marketing plan..."):
110
- website_content = scrape_website(website_url)
111
- if website_content:
112
- plan = generate_video_marketing_plan(website_content)
113
- if plan:
114
- st.markdown(plan)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ st.set_page_config(page_title="B2B Problem Solver", layout="wide")
3
 
4
  import requests
5
  import os
 
9
  OPENAI_API_KEY = os.getenv("OPENAI_API_KEY")
10
  OPENAI_ENDPOINT = "https://api.openai.com/v1/chat/completions"
11
 
12
+ # Define common business problem categories
13
+ PROBLEM_CATEGORIES = [
14
+ "Sales Pipeline Issues",
15
+ "Lead Generation Challenges",
16
+ "Customer Retention Problems",
17
+ "Marketing ROI Concerns",
18
+ "Product-Market Fit",
19
+ "Team Performance Issues",
20
+ "Competitive Positioning",
21
+ "Pricing Strategy",
22
+ "Market Expansion Difficulties",
23
+ "Digital Transformation Challenges",
24
+ "Customer Acquisition Costs",
25
+ "Other (Please Specify)"
26
+ ]
27
+
28
+ def scrape_company_info(url):
29
+ """Scrapes business information from the given company website URL."""
30
  if not url.startswith("http"):
31
  url = f"https://{url}"
32
 
 
51
  st.error(f"Error scraping website: {str(e)}")
52
  return None
53
 
54
+ def generate_problem_solution(business_info, problem_category, problem_description):
55
+ """Generates a practical solution for the specified business problem using OpenAI GPT-4."""
56
+ prompt = f"""As a senior B2B growth strategist with extensive experience helping sales and marketing executives overcome business challenges, provide a practical solution for the following scenario:
57
+
58
+ COMPANY INFORMATION:
59
  {business_info}
60
 
61
+ PROBLEM CATEGORY: {problem_category}
62
+
63
+ SPECIFIC PROBLEM:
64
+ {problem_description}
65
+
66
+ Please provide:
67
+
68
+ 1. **Problem Analysis**: Briefly analyze the root causes of this issue based on common patterns in B2B companies.
69
+
70
+ 2. **Strategic Solution**: Outline a clear, actionable solution that addresses the core problem.
71
+
72
+ 3. **Implementation Steps**: Provide 3-5 specific, tactical steps to implement the solution.
73
+
74
+ 4. **Expected Outcomes**: Describe the measurable results and timeframe they can expect.
75
+
76
+ 5. **Common Pitfalls**: Note 2-3 potential challenges they might face during implementation and how to avoid them.
77
 
78
+ 6. **Resource Requirements**: Briefly list any tools, skills, or resources needed.
79
+
80
+ Format your response in clear markdown with headers and bullet points, keeping it concise, practical, and immediately actionable for busy executives."""
81
 
82
  headers = {
83
  "Authorization": f"Bearer {OPENAI_API_KEY}",
 
87
  data = {
88
  "model": "gpt-4", # Using OpenAI GPT-4 model
89
  "messages": [
90
+ {"role": "system", "content": "You are a senior B2B growth strategist who specializes in solving critical business challenges for sales and marketing executives."},
91
  {"role": "user", "content": prompt}
92
  ],
93
  "temperature": 0.7,
94
+ "max_tokens": 3500
95
  }
96
 
97
  try:
 
103
  return None
104
 
105
  # Streamlit UI
106
+ st.title("🚀 B2B Problem Solver")
107
+ st.markdown("### Get practical solutions to common business problems hindering your growth")
108
+
109
+ with st.expander("💡 How it works", expanded=True):
110
+ st.markdown("""
111
+ 1. Enter your company details or website URL
112
+ 2. Select your most pressing business challenge
113
+ 3. Receive a customized, actionable solution plan
114
+ 4. Implement the steps to overcome your growth obstacle
115
+ """)
116
 
117
+ input_method = st.radio("Choose input method:", ["Enter company details manually", "Use company website URL"])
118
 
119
+ if input_method == "Enter company details manually":
120
+ company_name = st.text_input("Company Name*")
121
+ industry = st.text_input("Industry*")
122
+ company_description = st.text_area("What does your company do?*", help="Describe your products/services and target market.")
123
+ team_size = st.selectbox("Company Size", ["1-10 employees", "11-50 employees", "51-200 employees", "201-500 employees", "500+ employees"])
124
+
125
+ st.markdown("### What's your biggest challenge?")
126
+ problem_category = st.selectbox("Select problem category*", PROBLEM_CATEGORIES)
127
+ if problem_category == "Other (Please Specify)":
128
+ custom_category = st.text_input("Please specify your problem category")
129
+ problem_category = custom_category if custom_category else problem_category
130
 
131
+ problem_description = st.text_area("Describe your specific challenge*", help="Provide details about the problem you're facing and what you've tried so far.")
132
+
133
+ if st.button("Generate Solution"):
134
+ if not all([company_name, industry, company_description, problem_description]):
135
  st.error("Please fill in all required fields marked with *")
136
  else:
137
+ with st.spinner("Analyzing your business challenge and crafting a solution..."):
138
  business_info = f"""
139
+ Company Name: {company_name}
140
+ Industry: {industry}
141
+ Company Description: {company_description}
142
+ Company Size: {team_size}
143
  """
144
+ solution = generate_problem_solution(business_info, problem_category, problem_description)
145
+ if solution:
146
+ st.markdown("## Your Customized Solution Plan")
147
+ st.markdown(solution)
148
+
149
+ with st.expander("Want expert help implementing this solution?"):
150
+ st.markdown("""
151
+ Our growth agency specializes in helping B2B companies implement these solutions and achieve measurable results.
152
+
153
+ **Schedule a free 30-minute consultation** to discuss how we can help you overcome this challenge and accelerate your growth.
154
+ """)
155
+ st.text_input("Your Email")
156
+ st.button("Request Consultation")
157
+
158
  else:
159
+ website_url = st.text_input("Enter your company website URL*", placeholder="e.g., www.example.com")
160
 
161
+ st.markdown("### What's your biggest challenge?")
162
+ problem_category = st.selectbox("Select problem category*", PROBLEM_CATEGORIES)
163
+ if problem_category == "Other (Please Specify)":
164
+ custom_category = st.text_input("Please specify your problem category")
165
+ problem_category = custom_category if custom_category else problem_category
166
+
167
+ problem_description = st.text_area("Describe your specific challenge*", help="Provide details about the problem you're facing and what you've tried so far.")
168
+
169
+ if st.button("Generate Solution"):
170
+ if not all([website_url, problem_description]):
171
+ st.error("Please fill in all required fields marked with *")
172
  else:
173
+ with st.spinner("Extracting company details and generating your solution..."):
174
+ company_info = scrape_company_info(website_url)
175
+ if company_info:
176
+ solution = generate_problem_solution(company_info, problem_category, problem_description)
177
+ if solution:
178
+ st.markdown("## Your Customized Solution Plan")
179
+ st.markdown(solution)
180
+
181
+ with st.expander("Want expert help implementing this solution?"):
182
+ st.markdown("""
183
+ Our growth agency specializes in helping B2B companies implement these solutions and achieve measurable results.
184
+
185
+ **Schedule a free 30-minute consultation** to discuss how we can help you overcome this challenge and accelerate your growth.
186
+ """)
187
+ st.text_input("Your Email")
188
+ st.button("Request Consultation")
189
+
190
+ # Add footer with branding
191
+ st.markdown("---")
192
+ st.markdown("Powered by [Your Growth Agency Name] | Helping B2B companies overcome growth obstacles since [Year]")