bizvideoschool's picture
Update app.py
175d43a
raw
history blame
No virus
1.11 kB
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')