bizvideoschool
commited on
Commit
•
f23c1ac
1
Parent(s):
74f98d3
Update app.py
Browse files
app.py
CHANGED
@@ -4,29 +4,33 @@ import openai
|
|
4 |
# Access the OpenAI API key from Hugging Face Spaces secrets
|
5 |
openai.api_key = st.secrets["OPENAI_API_KEY"]
|
6 |
|
7 |
-
st.title("Holiday Video Script Generator for
|
8 |
-
|
9 |
-
# User inputs
|
10 |
-
agent_name = st.text_input("
|
11 |
-
|
12 |
-
|
13 |
-
personal_message = st.text_area("Personal Message", placeholder="
|
14 |
-
|
15 |
-
|
16 |
-
# Formulate the user input for the script
|
17 |
-
user_input = (
|
18 |
-
f"""You are an AI assistant that helps real estate agents create compelling holiday video scripts. Create a script that is festive, engaging, and approximately one minute long. Include elements like community engagement, local highlights, market insights, home decoration tips, and a personalized message from {agent_name}, focusing on the {community_focus} community. The holiday theme is {holiday_theme}. Include this personal message: {personal_message}. End with notes on suitable B-roll shots and music.
|
19 |
-
"""
|
20 |
-
)
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
29 |
)
|
30 |
|
31 |
-
# Display the
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
4 |
# Access the OpenAI API key from Hugging Face Spaces secrets
|
5 |
openai.api_key = st.secrets["OPENAI_API_KEY"]
|
6 |
|
7 |
+
st.title("Holiday Video Script Generator for Real Estate Agents")
|
8 |
+
|
9 |
+
# User inputs for personalization
|
10 |
+
agent_name = st.text_input("Agent's Name", placeholder="Enter your name")
|
11 |
+
neighborhood = st.text_input("Neighborhood or Area", placeholder="Enter the neighborhood or area you focus on")
|
12 |
+
unique_selling_points = st.text_input("Unique Selling Points", placeholder="Mention any unique selling points or achievements from the year")
|
13 |
+
personal_message = st.text_area("Personal Message", placeholder="Write a personal message you'd like to include", height=100)
|
14 |
+
|
15 |
+
generate_script_button = st.button('Generate Script')
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
+
if generate_script_button:
|
18 |
+
# Create the user input for the AI model
|
19 |
+
user_input = f"""
|
20 |
+
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.
|
21 |
+
"""
|
22 |
+
|
23 |
+
# Call the OpenAI API
|
24 |
+
response = openai.Completion.create(
|
25 |
+
model="gpt-4",
|
26 |
+
prompt=user_input,
|
27 |
+
max_tokens=300
|
28 |
)
|
29 |
|
30 |
+
# Display the script
|
31 |
+
script = response.choices[0].text.strip()
|
32 |
+
st.write("### Generated Script")
|
33 |
+
st.write(script)
|
34 |
+
|
35 |
+
st.write("### Notes for B-roll and Music (if applicable)")
|
36 |
+
st.write("Include here any notes on B-roll footage or background music that could enhance the video.")
|