bizvideoschool
commited on
Commit
•
a0464cb
1
Parent(s):
a3215c8
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,6 @@ from PIL import Image
|
|
5 |
from io import BytesIO
|
6 |
|
7 |
# Set up the OpenAI API key from Hugging Face Spaces secrets
|
8 |
-
# Ensure that you have added your OpenAI API key in the Hugging Face Spaces secrets under the name "OPENAI_API_KEY"
|
9 |
openai.api_key = st.secrets["OPENAI_API_KEY"]
|
10 |
|
11 |
st.title("Background Image Generator for Real Estate Videos")
|
@@ -14,6 +13,8 @@ st.title("Background Image Generator for Real Estate Videos")
|
|
14 |
image_theme = st.text_input("Image Theme", placeholder="Enter a theme for your image (e.g., modern living room)")
|
15 |
color_scheme = st.text_input("Color Scheme", placeholder="Preferred color scheme (e.g., warm, cool)")
|
16 |
additional_elements = st.text_input("Additional Elements", placeholder="Any specific elements to include in the image?")
|
|
|
|
|
17 |
|
18 |
if st.button('Generate Image'):
|
19 |
# Construct the prompt
|
@@ -22,9 +23,12 @@ if st.button('Generate Image'):
|
|
22 |
# Call the DALL-E API
|
23 |
try:
|
24 |
response = openai.Image.create(
|
|
|
25 |
prompt=prompt,
|
26 |
n=1, # Number of images to generate
|
27 |
-
size="1024x1024" # Image dimensions
|
|
|
|
|
28 |
)
|
29 |
|
30 |
# Assuming the response contains a URL to the image
|
|
|
5 |
from io import BytesIO
|
6 |
|
7 |
# Set up the OpenAI API key from Hugging Face Spaces secrets
|
|
|
8 |
openai.api_key = st.secrets["OPENAI_API_KEY"]
|
9 |
|
10 |
st.title("Background Image Generator for Real Estate Videos")
|
|
|
13 |
image_theme = st.text_input("Image Theme", placeholder="Enter a theme for your image (e.g., modern living room)")
|
14 |
color_scheme = st.text_input("Color Scheme", placeholder="Preferred color scheme (e.g., warm, cool)")
|
15 |
additional_elements = st.text_input("Additional Elements", placeholder="Any specific elements to include in the image?")
|
16 |
+
image_style = st.selectbox("Image Style", ["vivid", "natural"], index=0) # Select between vivid and natural styles
|
17 |
+
image_quality = st.selectbox("Image Quality", ["standard", "hd"], index=0) # Select between standard and HD quality
|
18 |
|
19 |
if st.button('Generate Image'):
|
20 |
# Construct the prompt
|
|
|
23 |
# Call the DALL-E API
|
24 |
try:
|
25 |
response = openai.Image.create(
|
26 |
+
model="dall-e-3", # Specify DALL-E 3 model
|
27 |
prompt=prompt,
|
28 |
n=1, # Number of images to generate
|
29 |
+
size="1024x1024", # Image dimensions
|
30 |
+
quality=image_quality, # Image quality parameter
|
31 |
+
style=image_style # Image style parameter
|
32 |
)
|
33 |
|
34 |
# Assuming the response contains a URL to the image
|