Commit
·
09b2212
1
Parent(s):
d0e7c6f
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
import streamlit as st
|
2 |
import openai
|
3 |
|
4 |
# Access the OpenAI API key from Hugging Face Spaces secrets
|
@@ -8,9 +8,9 @@ st.title("2024 Video Marketing Plan Generator with Class Recommendations")
|
|
8 |
|
9 |
# Function to recommend classes based on video-making experience
|
10 |
def recommend_classes(video_experience):
|
11 |
-
#
|
12 |
class_list = [
|
13 |
-
|
14 |
Getting Started with Video Using The 6-Step BVS Process
|
15 |
Class #1: Why Video Works and Outlining Your 12-Month Plan
|
16 |
Class #2: 6 Simple Steps to Creating a Video (Part 1)
|
@@ -311,25 +311,51 @@ Develop Your 2023 Real Estate Marketing Plan (Part 2)
|
|
311 |
Implement Tristan's SOI Video Touch System (Part 1)
|
312 |
Implement Tristan's SOI Video Touch System (Part 2)
|
313 |
"""
|
314 |
-
#
|
315 |
]
|
316 |
|
317 |
if video_experience < 3:
|
318 |
# Recommend earlier classes for beginners
|
319 |
-
return class_list[:3]
|
320 |
else:
|
321 |
# Recommend more advanced classes for experienced users
|
322 |
-
return class_list[-3:] #
|
323 |
|
324 |
# User inputs for the marketing plan
|
325 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
|
327 |
if st.button('Generate My Video Marketing Plan and Class Recommendations'):
|
328 |
# Construct the prompt for text generation
|
329 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
|
331 |
# Display the marketing plan
|
332 |
-
|
|
|
333 |
|
334 |
# Recommend classes based on video-making experience
|
335 |
class_recommendations = recommend_classes(video_experience)
|
@@ -337,6 +363,10 @@ if st.button('Generate My Video Marketing Plan and Class Recommendations'):
|
|
337 |
st.write(", ".join(class_recommendations))
|
338 |
|
339 |
# Copy to clipboard button
|
340 |
-
|
|
|
|
|
|
|
341 |
|
342 |
# No additional code needed beyond this point for your application
|
|
|
|
1 |
+
import streamlit as st
|
2 |
import openai
|
3 |
|
4 |
# Access the OpenAI API key from Hugging Face Spaces secrets
|
|
|
8 |
|
9 |
# Function to recommend classes based on video-making experience
|
10 |
def recommend_classes(video_experience):
|
11 |
+
# Full class list from the Small Business Video Roadmap
|
12 |
class_list = [
|
13 |
+
""" Course #1
|
14 |
Getting Started with Video Using The 6-Step BVS Process
|
15 |
Class #1: Why Video Works and Outlining Your 12-Month Plan
|
16 |
Class #2: 6 Simple Steps to Creating a Video (Part 1)
|
|
|
311 |
Implement Tristan's SOI Video Touch System (Part 1)
|
312 |
Implement Tristan's SOI Video Touch System (Part 2)
|
313 |
"""
|
314 |
+
# Add your full class list here
|
315 |
]
|
316 |
|
317 |
if video_experience < 3:
|
318 |
# Recommend earlier classes for beginners
|
319 |
+
return class_list[:3] # Adjust indices as needed
|
320 |
else:
|
321 |
# Recommend more advanced classes for experienced users
|
322 |
+
return class_list[-3:] # Adjust indices as needed
|
323 |
|
324 |
# User inputs for the marketing plan
|
325 |
+
st.subheader("Define Your Business and Audience")
|
326 |
+
business_type = st.text_input("Your Business Type", placeholder="e.g., Cafe, Yoga Studio")
|
327 |
+
target_audience = st.text_area("Describe Your Target Audience", placeholder="e.g., demographics, interests")
|
328 |
+
|
329 |
+
st.subheader("Current Marketing Efforts")
|
330 |
+
current_marketing = st.text_area("Current Marketing Strategies", placeholder="Describe your ongoing marketing activities.")
|
331 |
+
|
332 |
+
st.subheader("Your Video Making Experience")
|
333 |
+
video_experience = st.number_input("How many videos have you made in the past month?", min_value=0, max_value=100, step=1)
|
334 |
|
335 |
if st.button('Generate My Video Marketing Plan and Class Recommendations'):
|
336 |
# Construct the prompt for text generation
|
337 |
+
prompt_text = (
|
338 |
+
f"Generate a 2024 video marketing plan for a {business_type} targeting an audience characterized as: {target_audience}. "
|
339 |
+
f"Include up to four video ideas for each month and 10 specific distribution strategies to maximize video views, "
|
340 |
+
f"based on current marketing efforts: {current_marketing}."
|
341 |
+
)
|
342 |
+
|
343 |
+
# Call the OpenAI API for text generation
|
344 |
+
try:
|
345 |
+
response_text = openai.ChatCompletion.create(
|
346 |
+
model="gpt-4",
|
347 |
+
messages=[
|
348 |
+
{"role": "system", "content": "You are an AI specializing in marketing strategy."},
|
349 |
+
{"role": "user", "content": prompt_text}
|
350 |
+
]
|
351 |
+
)
|
352 |
+
marketing_plan = response_text.choices[0].message['content']
|
353 |
+
except Exception as e:
|
354 |
+
marketing_plan = f"Error in generating marketing plan: {e}"
|
355 |
|
356 |
# Display the marketing plan
|
357 |
+
st.markdown("### Your Customized Video Marketing Plan")
|
358 |
+
st.write(marketing_plan)
|
359 |
|
360 |
# Recommend classes based on video-making experience
|
361 |
class_recommendations = recommend_classes(video_experience)
|
|
|
363 |
st.write(", ".join(class_recommendations))
|
364 |
|
365 |
# Copy to clipboard button
|
366 |
+
if marketing_plan:
|
367 |
+
full_text = marketing_plan + "\n\nRecommended Classes: " + ", ".join(class_recommendations)
|
368 |
+
st.text_area("Copy and paste the plan and recommendations:", full_text, height=300, key="text_area")
|
369 |
+
st.button("Copy to Clipboard", key="copy-button")
|
370 |
|
371 |
# No additional code needed beyond this point for your application
|
372 |
+
|