nniehaus commited on
Commit
babda6f
·
verified ·
1 Parent(s): e366aca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -15
app.py CHANGED
@@ -58,8 +58,16 @@ def scrape_website(url, max_pages=5):
58
  initial_messages = [{
59
  "role": "system",
60
  "content": """You are a world-class marketing strategist trained by Neil Patel, David Ogilvy, and Seth Godin.
61
- You specialize in creating precise, highly actionable, and detailed 1-year marketing plans tailored to businesses' specific needs.
62
- Ensure all advice aligns with the user's goals and strengths."""
 
 
 
 
 
 
 
 
63
  }]
64
 
65
  def call_openai_api(messages):
@@ -84,17 +92,11 @@ def generate_marketing_plan(website_content, industry, goals, budget, messages,
84
  - Industry: {industry}
85
  - Goals for 2025: {goals}
86
  - Marketing budget for 2025: ${budget}
87
- Create a comprehensive, customized 1-year marketing plan for 2025.
88
- Include:
89
- 1. **Overview**: Summarize the input details, highlighting any missing information.
90
- 2. **Keywords**: Provide a list of specific keywords to target for blogs, videos, and SEO.
91
- 3. **Content Topics**: Suggest blog and YouTube video topics with detailed titles.
92
- 4. **Social Media**: Recommend platforms, posting frequency, and campaign ideas with measurable goals.
93
- 5. **Advertising Campaigns**: Outline paid ad strategies, including platforms, target audiences, and budget allocation.
94
- 6. **SEO Improvements**: Suggest tools, techniques, and steps to improve search rankings.
95
- 7. **Execution Steps**: Provide actionable, step-by-step instructions for each recommendation.
96
- Ensure all suggestions align with the business's goals and strengths, and include a quarterly timeline for implementation.
97
- If fallback mode is active, note the lack of website content in the overview but still provide high-value recommendations based on the user's input."""
98
 
99
  messages.append({"role": "user", "content": query})
100
  return call_openai_api(messages)
@@ -105,6 +107,8 @@ st.set_page_config(layout="wide")
105
  # Initialize session state
106
  if "reply" not in st.session_state:
107
  st.session_state["reply"] = None
 
 
108
 
109
  # Centered title
110
  st.markdown("<h1 style='text-align: center; color: black;'>2025 Marketing Planner</h1>", unsafe_allow_html=True)
@@ -113,7 +117,7 @@ st.markdown("<h1 style='text-align: center; color: black;'>2025 Marketing Planne
113
  col1, col2 = st.columns(2)
114
  with col1:
115
  st.markdown("<h2 style='text-align: center; color: black;'>Enter Business Details</h2>", unsafe_allow_html=True)
116
- website_url = st.text_input("Enter your business website", placeholder="example.com (no need for https://)")
117
  industry = st.text_input("Industry", placeholder="E.g., Real Estate, Retail, Technology")
118
  goals = st.text_area("Goals for 2025", placeholder="E.g., increase brand awareness, drive online sales")
119
  budget = st.number_input("Marketing Budget for 2025 ($)", min_value=1000, step=1000)
@@ -121,7 +125,7 @@ with col1:
121
 
122
  # Process results on button click
123
  if generate_button:
124
- st.info("Generating your marketing plan. This process may take a minute or two. Please wait...")
125
  with st.spinner("Analyzing website content and preparing your report..."):
126
  website_content, scrape_successful = scrape_website(website_url) if website_url else ("", False)
127
  fallback_mode = not scrape_successful
@@ -132,6 +136,11 @@ if generate_button:
132
  website_content if scrape_successful else "N/A",
133
  industry, goals, budget, messages, fallback=fallback_mode
134
  )
 
 
 
 
 
135
 
136
  # Display results if there is a reply in session state
137
  if st.session_state["reply"]:
 
58
  initial_messages = [{
59
  "role": "system",
60
  "content": """You are a world-class marketing strategist trained by Neil Patel, David Ogilvy, and Seth Godin.
61
+ Your task is to create highly customized and innovative marketing plans based on the provided details.
62
+ Go beyond generic strategies and use advanced analysis to recommend:
63
+ - Marketing tactics inspired by successful case studies from the same or similar industries.
64
+ - Unique approaches that leverage emerging trends, tools, and platforms.
65
+ - Recommendations that align with the business's budget and specific goals.
66
+ Each strategy must:
67
+ - Be actionable, with clear steps to execute.
68
+ - Include measurable KPIs to track success.
69
+ - Be specific to the business's industry, competitive landscape, and target audience.
70
+ Ensure every suggestion feels fresh, creative, and deeply tailored to the business's needs."""
71
  }]
72
 
73
  def call_openai_api(messages):
 
92
  - Industry: {industry}
93
  - Goals for 2025: {goals}
94
  - Marketing budget for 2025: ${budget}
95
+ Create a comprehensive, customized 1-year marketing plan for 2025, including:
96
+ - Advanced analysis based on successful case studies and trends.
97
+ - Unique strategies for the business to stand out.
98
+ - Actionable steps with measurable KPIs.
99
+ Avoid generic suggestions; focus on innovative and practical ideas."""
 
 
 
 
 
 
100
 
101
  messages.append({"role": "user", "content": query})
102
  return call_openai_api(messages)
 
107
  # Initialize session state
108
  if "reply" not in st.session_state:
109
  st.session_state["reply"] = None
110
+ if "show_notice" not in st.session_state:
111
+ st.session_state["show_notice"] = False
112
 
113
  # Centered title
114
  st.markdown("<h1 style='text-align: center; color: black;'>2025 Marketing Planner</h1>", unsafe_allow_html=True)
 
117
  col1, col2 = st.columns(2)
118
  with col1:
119
  st.markdown("<h2 style='text-align: center; color: black;'>Enter Business Details</h2>", unsafe_allow_html=True)
120
+ website_url = st.text_input("Enter your business website", placeholder="e.g., https://example.com")
121
  industry = st.text_input("Industry", placeholder="E.g., Real Estate, Retail, Technology")
122
  goals = st.text_area("Goals for 2025", placeholder="E.g., increase brand awareness, drive online sales")
123
  budget = st.number_input("Marketing Budget for 2025 ($)", min_value=1000, step=1000)
 
125
 
126
  # Process results on button click
127
  if generate_button:
128
+ st.session_state["show_notice"] = True
129
  with st.spinner("Analyzing website content and preparing your report..."):
130
  website_content, scrape_successful = scrape_website(website_url) if website_url else ("", False)
131
  fallback_mode = not scrape_successful
 
136
  website_content if scrape_successful else "N/A",
137
  industry, goals, budget, messages, fallback=fallback_mode
138
  )
139
+ st.session_state["show_notice"] = False # Remove the notice once the report is ready
140
+
141
+ # Display the waiting notice
142
+ if st.session_state["show_notice"]:
143
+ st.info("Generating your marketing plan. This process may take a minute or two. Please wait...")
144
 
145
  # Display results if there is a reply in session state
146
  if st.session_state["reply"]: