Spaces:
Runtime error
Runtime error
bizvideoschool
commited on
Commit
•
175d43a
1
Parent(s):
3cd9850
Update app.py
Browse files
app.py
CHANGED
@@ -1,39 +1,27 @@
|
|
1 |
import streamlit as st
|
2 |
import openai
|
3 |
|
4 |
-
# Access the OpenAI API key
|
5 |
openai.api_key = st.secrets["YOUR_OPENAI_API_KEY"]
|
6 |
|
7 |
-
st.title("
|
8 |
|
9 |
-
# User inputs
|
10 |
-
|
11 |
-
|
12 |
-
|
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 |
-
|
16 |
-
|
17 |
-
|
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 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
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
|
39 |
-
|
|
|
|
1 |
import streamlit as st
|
2 |
import openai
|
3 |
|
4 |
+
# Access the OpenAI API key
|
5 |
openai.api_key = st.secrets["YOUR_OPENAI_API_KEY"]
|
6 |
|
7 |
+
st.title("Real Estate Video Background Image Generator")
|
8 |
|
9 |
+
# User inputs for image generation
|
10 |
+
image_theme = st.text_input("Image Theme", placeholder="Enter a theme for your image (e.g., cozy living room, modern office)")
|
11 |
+
color_scheme = st.text_input("Color Scheme", placeholder="Preferred color scheme (e.g., warm, cool, monochromatic)")
|
12 |
+
additional_elements = st.text_input("Additional Elements", placeholder="Any specific elements to include in the image?")
|
|
|
13 |
|
14 |
+
if st.button('Generate Image'):
|
15 |
+
# Construct the prompt
|
16 |
+
prompt = f"Create an image with the theme: '{image_theme}', color scheme: '{color_scheme}', including elements: '{additional_elements}'."
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
+
# Call the DALL-E API
|
19 |
+
response = openai.Image.create(
|
20 |
+
prompt=prompt,
|
21 |
+
n=1, # Number of images to generate
|
22 |
+
size="1024x1024" # Image dimensions
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
)
|
24 |
|
25 |
+
# Display the image
|
26 |
+
image_data = response.data[0] # Assuming response contains image data
|
27 |
+
st.image(image_data, caption='Generated Image')
|