bizvideoschool's picture
Update app.py
0a99cb6
raw
history blame
1.87 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.
"""
# 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.")