File size: 1,112 Bytes
bf70abc
0a480c8
c1fbddd
175d43a
0a99cb6
bf70abc
175d43a
f23c1ac
175d43a
 
 
 
3cd9850
175d43a
 
 
3cd9850
175d43a
 
 
 
 
3e809b7
 
175d43a
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import streamlit as st
import openai

# Access the OpenAI API key
openai.api_key = st.secrets["YOUR_OPENAI_API_KEY"]

st.title("Real Estate Video Background Image Generator")

# User inputs for image generation
image_theme = st.text_input("Image Theme", placeholder="Enter a theme for your image (e.g., cozy living room, modern office)")
color_scheme = st.text_input("Color Scheme", placeholder="Preferred color scheme (e.g., warm, cool, monochromatic)")
additional_elements = st.text_input("Additional Elements", placeholder="Any specific elements to include in the image?")

if st.button('Generate Image'):
    # Construct the prompt
    prompt = f"Create an image with the theme: '{image_theme}', color scheme: '{color_scheme}', including elements: '{additional_elements}'."

    # Call the DALL-E API
    response = openai.Image.create(
        prompt=prompt,
        n=1,  # Number of images to generate
        size="1024x1024"  # Image dimensions
    )

    # Display the image
    image_data = response.data[0]  # Assuming response contains image data
    st.image(image_data, caption='Generated Image')