import streamlit as st import openai import requests from PIL import Image from io import BytesIO # Access the OpenAI API key from Hugging Face Spaces secrets openai.api_key = st.secrets["OPENAI_API_KEY"] st.title("Advanced 2024 Video Marketing Plan Generator") # User inputs for the marketing plan st.subheader("Define Your Target Audience") customer_profile = st.text_area("Describe Your Ideal Customer", placeholder="Age, interests, demographics, etc.") st.subheader("Your Business Highlights") business_differentiators = st.text_input("Key Differentiators", placeholder="What makes your business unique?") st.subheader("Current Marketing Efforts") current_marketing_efforts = st.text_area("Current Marketing Strategies", placeholder="Describe your ongoing marketing activities.") st.subheader("Budget Considerations") marketing_budget = st.text_input("Marketing Budget", placeholder="Estimated budget for video marketing") if st.button('Generate My Detailed Video Marketing Plan'): # Construct the prompt for text generation prompt_text = ( f"Create a comprehensive and detailed 2024 video marketing plan for a business targeting customers with the following profile: {customer_profile}. " f"Include fleshed-out video ideas, partial script suggestions, and strategic advice. " f"Key differentiators: {business_differentiators}. Current marketing efforts: {current_marketing_efforts}. " f"Budget: {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 expert marketing strategist."}, {"role": "user", "content": prompt_text} ] ) detailed_marketing_plan = response_text.choices[0].message['content'] except Exception as e: detailed_marketing_plan = f"Error in generating detailed marketing plan: {e}" # Display the detailed marketing plan st.markdown("### Your Comprehensive Video Marketing Plan") st.write(detailed_marketing_plan) # Additional features like image generation can be added here if relevant