import streamlit as st import openai import os # Ensure your OpenAI API key is set in your environment variables openai.api_key = os.environ["OPENAI_API_KEY"] # Initial system message setup for the video idea generator initial_messages = [{ "role": "system", "content": """ You are an assistant that helps small businesses generate creative video ideas. Based on the business description and their ideal customer profile, provide 10 actionable and relevant video content ideas. Focus on ideas that align with the business goals and resonate with their target audience. """ }] def call_openai_api(messages): return openai.ChatCompletion.create( model="gpt-4", messages=messages, max_tokens=700 # Adjust based on the expected length of the video ideas ) def generate_video_ideas(business_description, ideal_customer, messages): query = f""" Generate 10 video ideas for a small business based on the following information: - Business Description: {business_description} - Ideal Customer: {ideal_customer} Provide actionable and creative video ideas that the business can use to attract and engage their target audience. """ messages.append({"role": "user", "content": query}) response = call_openai_api(messages) ChatGPT_reply = response["choices"][0]["message"]["content"] messages.append({"role": "assistant", "content": ChatGPT_reply}) return ChatGPT_reply, messages # Streamlit setup st.set_page_config(layout="wide") # Initialize session state if "reply" not in st.session_state: st.session_state["reply"] = None # Centered title st.markdown("