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 topic generator initial_messages = [{ "role": "system", "content": """ You are an assistant helping a real estate agent brainstorm video topics and outlines. Based on a specified goal or area of focus, suggest five video topics with outlines. Each topic should be numbered (1-5) and should include: - A catchy title for the video - A brief summary of the video's content - Key points or segments the video should cover (bullet points) """ }] def call_openai_api(messages): return openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=messages, max_tokens=500 ) def CustomChatGPT(goal, messages): query = f""" The real estate agent's goal is: {goal}. Please provide five video topic ideas with the following structure: 1. Title: A catchy title 2. Summary: Brief description of the content 3. Key Points: Bullet points of segments to cover """ 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("