bizvideoschool's picture
Update app.py
c189435
raw
history blame
No virus
2.14 kB
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 for personalization
agent_name = st.text_input("Agent's Name", placeholder="Enter your name")
neighborhood = st.text_input("Neighborhood or Area", placeholder="Enter the neighborhood or area you focus on")
unique_selling_points = st.text_input("Unique Selling Points", placeholder="Mention any unique selling points or achievements from the year")
personal_message = st.text_area("Personal Message", placeholder="Write a personal message you'd like to include", height=100)
generate_script_button = st.button('Generate Script')
if generate_script_button:
# Create the user input for the AI model
user_input = f"""
Create a festive and engaging one-minute holiday video script for a real estate agent named {agent_name}. The script should
focus on the neighborhood of {neighborhood}, incorporate unique selling points: {unique_selling_points}, and include the personal
message: {personal_message}. The script should be warm, welcoming, and build a sense of community. Keep it professional yet personal.
The final script should only contain the words the agent should read into the camera. It should not contain different shots or scenes.
You can make recommendations on backgrounds or b-roll after the script if you have ideas for those.
"""
# Call the OpenAI API with the correct endpoint for chat models
response = openai.ChatCompletion.create(
model="gpt-4",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": user_input}
]
)
# Display the script
script = response.choices[0].message['content'].strip()
st.write("### Generated Script")
st.write(script)
st.write("### Notes for B-roll and Music (if applicable)")
st.write("Include here any notes on B-roll footage or background music that could enhance the video.")