bizvideoschool commited on
Commit
3cd9850
1 Parent(s): c189435

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -28
app.py CHANGED
@@ -6,37 +6,34 @@ openai.api_key = st.secrets["YOUR_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
21
- focus on the neighborhood of {neighborhood}, incorporate unique selling points: {unique_selling_points}, and include the personal
22
- message: {personal_message}. The script should be warm, welcoming, and build a sense of community. Keep it professional yet personal.
23
- The final script should only contain the words the agent should read into the camera. It should not contain different shots or scenes.
24
- You can make recommendations on backgrounds or b-roll after the script if you have ideas for those.
25
- """
26
-
27
- # Call the OpenAI API with the correct endpoint for chat models
 
 
28
  response = openai.ChatCompletion.create(
29
- model="gpt-4",
30
  messages=[
31
- {"role": "system", "content": "You are a helpful assistant."},
32
  {"role": "user", "content": user_input}
33
  ]
34
  )
35
 
36
- # Display the script
37
- script = response.choices[0].message['content'].strip()
38
- st.write("### Generated Script")
39
- st.write(script)
40
-
41
- st.write("### Notes for B-roll and Music (if applicable)")
42
- st.write("Include here any notes on B-roll footage or background music that could enhance the video.")
 
6
 
7
  st.title("Holiday Video Script Generator for Real Estate Agents")
8
 
9
+ # User inputs
10
+ agent_name = st.text_input("Your Name", placeholder="Enter your name")
11
+ local_area = st.text_input("Your Local Area", placeholder="Enter the area you serve (e.g., Southwest Garden, St. Louis)")
12
+ holiday_theme = st.text_input("Holiday Theme", placeholder="Enter a specific holiday theme or message (e.g., community spirit, gratitude, holiday events)")
13
+ call_to_action = st.text_input("Call to Action", placeholder="Enter your desired call to action (e.g., visit your website, schedule a consultation)")
14
+
15
+ initial_messages = [{
16
+ "role": "system",
17
+ "content": """Act as a real estate marketing video script writer specialized in holiday-themed scripts. Respond with
18
+ fully written video scripts that contain only the words to be read out loud into the camera by a real estate agent.
19
+ These scripts should not include shot directions, references to who is speaking, or any other extraneous notes.
20
+ Create distinctive, succinct, and compelling scripts ideal for short social media videos. Start with engaging opening lines,
21
+ avoid generic greetings, and conclude with a strong call to action based on the agent's input. Base the script on the specific
22
+ holiday theme or topic provided by the agent."""
23
+ }]
24
+
25
+ if st.button('Generate Script'):
26
+ # Process the inputs and call the OpenAI API
27
+ user_input = f"Create a holiday video script for a real estate agent named {agent_name}, serving the {local_area} area. The holiday theme is '{holiday_theme}'. The script should end with a call to action: '{call_to_action}'."
28
+
29
+ # Call the OpenAI API with the chat model
30
  response = openai.ChatCompletion.create(
31
+ model="gpt-4", # Replace with the GPT-4 model you are using
32
  messages=[
33
+ {"role": "system", "content": initial_messages[0]["content"]},
34
  {"role": "user", "content": user_input}
35
  ]
36
  )
37
 
38
+ # Display the response from the API
39
+ st.write(response.choices[0].message['content'])