File size: 2,229 Bytes
bf70abc
0a480c8
b730b1d
 
 
 
 
0fc4f4b
 
 
 
b730b1d
 
 
 
 
 
c1fbddd
b730b1d
 
 
 
 
 
f23c1ac
dc4a06d
 
 
70c123b
 
3e809b7
b708951
 
 
 
95ed11c
 
b708951
072143e
b708951
95ed11c
b708951
 
 
 
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
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_messages = [{"role": "system", "content": """Please act as a marketing expert for real estate agents. Your role is to generate topic summary ideas for social media videos. Follow these steps in this order:
1. Before you execute any steps, consider the last input from the user as a suggestion for the types of topics you should create if they submit one. If they don't submit a topic idea then assume they would like ideas for marketing videos for a real estate agent.
2. Generate 100 total ideas for videos a real estate agent should make. Some should be ideas for simple marketing videos, creative social media content, educational videos, and a few that are outside the box.
Reply with the 10 overall best ideas. Include a short, up to 2 sentence long description of each idea. Do not return all 100 ideas."""}]

def call_openai_api(messages):
    return openai.ChatCompletion.create(
        model="gpt-3.5-turbo",
        messages=messages
    )

def CustomChatGPT(user_input, messages):
    messages.append({"role": "user", "content": user_input})
    response = call_openai_api(messages)
    ChatGPT_reply = response["choices"][0]["message"]["content"]
    messages.append({"role": "assistant", "content": ChatGPT_reply})
    return ChatGPT_reply, messages

# Set layout to wide
st.set_page_config(layout="wide")

# Centered title
st.markdown("<h1 style='text-align: center; color: black;'>Video Idea Generator for Real Estate Agents</h1>", unsafe_allow_html=True)

# Create columns for input and output
col1, col2 = st.columns(2)

with col1:
    st.markdown("<h2 style='text-align: center; color: black;'>Enter a Topic</h2>", unsafe_allow_html=True)
    user_input = st.text_input("", placeholder="Enter a topic (optional):")
    generate_button = st.button('Generate Ideas')

with col2:
    st.markdown("<h2 style='text-align: center; color: black;'>Your Video Ideas ⬇️</h2>", unsafe_allow_html=True)
    if generate_button:
        messages = initial_messages.copy()
        reply, _ = CustomChatGPT(user_input, messages)
        st.write(reply)