File size: 2,143 Bytes
bf70abc 0a480c8 c1fbddd 3e809b7 0a99cb6 bf70abc f23c1ac 3e809b7 f23c1ac c189435 f23c1ac 0a99cb6 f23c1ac 0a99cb6 3e809b7 f23c1ac 0a99cb6 f23c1ac |
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 |
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.")
|