File size: 2,847 Bytes
bf70abc 0a480c8 c1fbddd 757b271 bf70abc 71eee80 f23c1ac ed5f436 71eee80 757b271 a2b71e3 71eee80 a2b71e3 757b271 85e1e8f 757b271 71eee80 757b271 71eee80 757b271 71eee80 a2b71e3 71eee80 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 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 54 55 |
import streamlit as st
import openai
# Access the OpenAI API key from Hugging Face Spaces secrets
openai.api_key = st.secrets["OPENAI_API_KEY"]
st.title("2024 Video Marketing Plan Generator")
# User inputs for the marketing plan
st.subheader("Define Your Business and Audience")
business_type = st.text_input("Your Business Type", placeholder="e.g., Cafe, Yoga Studio")
target_audience = st.text_area("Describe Your Target Audience", placeholder="e.g., demographics, interests")
st.subheader("Current Marketing and Budget")
current_marketing = st.text_area("Current Marketing Efforts", placeholder="What are your ongoing marketing activities?")
marketing_budget = st.text_input("Annual Marketing Budget", placeholder="Enter your budget for the year")
# Test data button
if st.button('Load Test Data'):
st.session_state['business_type'] = "Fitness Studio"
st.session_state['target_audience'] = "Young adults interested in health and wellness"
st.session_state['current_marketing'] = "Social media campaigns, local community events"
st.session_state['marketing_budget'] = "50000"
# Use session state for input fields
business_type = st.text_input("Your Business Type", value=st.session_state.get('business_type', ''), placeholder="e.g., Cafe, Yoga Studio")
target_audience = st.text_area("Describe Your Target Audience", value=st.session_state.get('target_audience', ''), placeholder="e.g., demographics, interests")
current_marketing = st.text_area("Current Marketing Efforts", value=st.session_state.get('current_marketing', ''), placeholder="What are your ongoing marketing activities?")
marketing_budget = st.text_input("Annual Marketing Budget", value=st.session_state.get('marketing_budget', ''), placeholder="Enter your budget for the year")
if st.button('Generate My Video Marketing Plan'):
# Construct the prompt for text generation
prompt_text = (
f"Generate a 2024 video marketing plan for a {business_type} targeting an audience characterized as: {target_audience}. "
f"Include content pillars, and monthly video recommendations based on the current marketing efforts: {current_marketing} "
f"and an annual marketing budget of {marketing_budget}."
)
# Call the OpenAI API for text generation
try:
response_text = openai.ChatCompletion.create(
model="gpt-4",
messages=[
{"role": "system", "content": "You are an AI specializing in marketing strategy."},
{"role": "user", "content": prompt_text}
]
)
marketing_plan = response_text.choices[0].message['content']
except Exception as e:
marketing_plan = f"Error in generating marketing plan: {e}"
# Display the marketing plan
st.markdown("### Your Customized Video Marketing Plan")
st.write(marketing_plan)
|