Spaces:
Runtime error
Runtime error
bizvideoschool
commited on
Commit
•
a7cf0d8
1
Parent(s):
2644789
Update app.py
Browse files
app.py
CHANGED
@@ -7,20 +7,20 @@ from io import BytesIO
|
|
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("
|
11 |
|
12 |
# User inputs for image generation
|
13 |
st.subheader("Define Your Business")
|
14 |
-
business_type = st.text_input("Your Business Type", placeholder="e.g., Cafe, Florist,
|
15 |
|
16 |
-
st.subheader("
|
17 |
-
video_theme = st.text_input("Video Theme", placeholder="
|
18 |
-
color_scheme = st.text_input("Color Scheme", placeholder="
|
19 |
-
additional_elements = st.text_input("Additional Elements", placeholder="
|
20 |
|
21 |
if st.button('Generate Image'):
|
22 |
-
# Construct the prompt
|
23 |
-
prompt = f"Create a vertical image
|
24 |
|
25 |
# Call the DALL-E API
|
26 |
try:
|
@@ -28,7 +28,7 @@ if st.button('Generate Image'):
|
|
28 |
model="dall-e-3", # Specify DALL-E 3 model
|
29 |
prompt=prompt,
|
30 |
n=1,
|
31 |
-
size="1024x1792", # Set image dimensions to vertical
|
32 |
quality="standard" # Set image quality to standard for lower cost
|
33 |
)
|
34 |
|
@@ -40,7 +40,7 @@ if st.button('Generate Image'):
|
|
40 |
image = Image.open(BytesIO(image_response.content))
|
41 |
|
42 |
# Display the image
|
43 |
-
st.image(image, caption='Generated
|
44 |
|
45 |
except Exception as e:
|
46 |
st.error(f"An error occurred: {e}")
|
|
|
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("Valentine's Day Video Backdrop Generator")
|
11 |
|
12 |
# User inputs for image generation
|
13 |
st.subheader("Define Your Business")
|
14 |
+
business_type = st.text_input("Your Business Type", placeholder="e.g., Cafe, Florist, Jewelry Store")
|
15 |
|
16 |
+
st.subheader("Valentine's Day Backdrop Details")
|
17 |
+
video_theme = st.text_input("Video Theme", placeholder="Valentine's Day theme for your video (e.g., romantic dinner, bouquet of flowers, gift showcase)")
|
18 |
+
color_scheme = st.text_input("Color Scheme", placeholder="Valentine's Day color scheme (e.g., red and white, pink and gold)")
|
19 |
+
additional_elements = st.text_input("Additional Elements", placeholder="Valentine's Day specific elements to include (e.g., hearts, chocolates, candles)")
|
20 |
|
21 |
if st.button('Generate Image'):
|
22 |
+
# Construct the prompt for Valentine's Day theme
|
23 |
+
prompt = f"Create a vertical image for a {business_type} with a Valentine's Day theme: '{video_theme}', color scheme: '{color_scheme}', including elements: '{additional_elements}'. This image will be used as a backdrop for a TikTok or Instagram Reels video."
|
24 |
|
25 |
# Call the DALL-E API
|
26 |
try:
|
|
|
28 |
model="dall-e-3", # Specify DALL-E 3 model
|
29 |
prompt=prompt,
|
30 |
n=1,
|
31 |
+
size="1024x1792", # Set image dimensions to vertical for TikTok or Reels
|
32 |
quality="standard" # Set image quality to standard for lower cost
|
33 |
)
|
34 |
|
|
|
40 |
image = Image.open(BytesIO(image_response.content))
|
41 |
|
42 |
# Display the image
|
43 |
+
st.image(image, caption='Generated Valentine\'s Day Video Backdrop Image')
|
44 |
|
45 |
except Exception as e:
|
46 |
st.error(f"An error occurred: {e}")
|