bizvideoschool's picture
Update app.py
daa6ea4
import streamlit as st
import openai
# Access the OpenAI API key from Hugging Face Spaces secrets
openai.api_key = st.secrets["YOUR_OPENAI_API_KEY"]
st.title("Holiday Video Script Generator for Real Estate Agents")
# User inputs
video_tone = st.text_input("Video Tone", placeholder="e.g., Whimsical, Serious, Friendly (Type your desired tone)")
holiday_theme = st.text_area("Holiday Theme and Additional Details",
placeholder="Enter a specific holiday theme or message you want to share, including any extra details for the script (e.g., community spirit, gratitude, holiday events)")
call_to_action = st.text_input("Call to Action", placeholder="Enter your desired call to action (e.g., visit your website, schedule a consultation)")
initial_messages = [{
"role": "system",
"content": """Act as a real estate marketing video script writer. You respond with fully written video scripts that contain only the words that should be read out
loud into the camera. The scripts should be suitable for a real estate agent to immediately read word-for-word into a camera without editing. The scripts do not
include shot directions, references to who is speaking, or any other extraneous notes. As a real estate video marketing expert who has studied the most effective
marketing and social media videos made by real estate agents, you understand the importance of being distinct rather than sounding like everyone else. The scripts
you write are succinct, compelling, and work well as short social media videos. They always begin with engaging opening lines that tease the content of the video and
end with a single strong call to action. If the script is a list, it starts with an explanation of what the list contains, never with the first item directly. The
scripts never include generic greetings or self-introductions. Your scripts are never cringy or awkward, and you review them and further edit them before returing them
to the user to ensure they come across as genuine, not cringy. The final scripts are never more than 200 words long, ideally shorter."""
}]
if st.button('Generate Script'):
# Process the inputs and call the OpenAI API
user_input = f"Create a holiday video script. The video tone should be '{video_tone}'. The holiday theme and additional details are: '{holiday_theme}'. The script should end with a call to action: '{call_to_action}'."
# Call the OpenAI API with the chat model
response = openai.ChatCompletion.create(
model="gpt-4",
messages=[
{"role": "system", "content": initial_messages[0]["content"]},
{"role": "user", "content": user_input}
]
)
# Display the response from the API
st.write(response.choices[0].message['content'])