bizvideoschool commited on
Commit
e53733f
1 Parent(s): c3fad62

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -15,15 +15,13 @@ color_scheme = st.text_input("Color Scheme", placeholder="Preferred color scheme
15
  additional_elements = st.text_input("Additional Elements", placeholder="Any specific elements to include in the image (e.g., Christmas tree, snowflakes)")
16
 
17
  # Dropdown for selecting image dimensions
18
- video_format = st.selectbox("Video Format", ["16:9 (Standard HD - 1920x1080)", "16:9 (4K - 3840x2160)", "1:1 (Square - 1080x1080)", "4:5 (Portrait - 1080x1350)", "9:16 (Tall - 1080x1920)"])
19
 
20
  # Mapping formats to DALL-E API size parameters
21
  format_size_mapping = {
22
- "16:9 (Standard HD - 1920x1080)": "1024x576", # Closest available size in DALL-E for 1080p
23
- "16:9 (4K - 3840x2160)": "1792x1024", # Closest available size in DALL-E for 4K
24
  "1:1 (Square - 1080x1080)": "1024x1024",
25
- "4:5 (Portrait - 1080x1350)": "1024x1792", # Closest available vertical size
26
- "9:16 (Tall - 1080x1920)": "1024x1792" # Closest available vertical size
27
  }
28
 
29
  if st.button('Generate Image'):
@@ -36,8 +34,8 @@ if st.button('Generate Image'):
36
  model="dall-e-3", # Specify DALL-E 3 model
37
  prompt=prompt,
38
  n=1,
39
- size=format_size_mapping[video_format], # Set image dimensions based on selected video format
40
- quality="hd" # Set image quality to high definition
41
  )
42
 
43
  # Assuming the response contains a URL to the image
 
15
  additional_elements = st.text_input("Additional Elements", placeholder="Any specific elements to include in the image (e.g., Christmas tree, snowflakes)")
16
 
17
  # Dropdown for selecting image dimensions
18
+ video_format = st.selectbox("Video Format", ["16:9 (Standard HD - 1920x1080)", "1:1 (Square - 1080x1080)", "4:5 (Portrait - 1080x1350)"])
19
 
20
  # Mapping formats to DALL-E API size parameters
21
  format_size_mapping = {
22
+ "16:9 (Standard HD - 1920x1080)": "1024x576", # Reduced size for 1080p
 
23
  "1:1 (Square - 1080x1080)": "1024x1024",
24
+ "4:5 (Portrait - 1080x1350)": "1024x768", # Reduced size for portrait
 
25
  }
26
 
27
  if st.button('Generate Image'):
 
34
  model="dall-e-3", # Specify DALL-E 3 model
35
  prompt=prompt,
36
  n=1,
37
+ size=format_size_mapping[video_format], # Set reduced image dimensions based on selected video format
38
+ quality="standard" # Set image quality to standard for lower cost
39
  )
40
 
41
  # Assuming the response contains a URL to the image