Adding furniture to empty room images and visualizing the furnishing and interior decor
To upload files, please first save the app
import streamlit as st
from PIL import Image
import io
import requests
st.title("Room Interior Visualizer")
st.write("""
Upload an empty room image and see how it would look with different furniture layouts.
Currently this is a demo app showing sample layouts.
""")
uploaded_file = st.file_uploader("Upload an empty room image", type=['png', 'jpg', 'jpeg'])
# Sample furniture layouts
furniture_layouts = {
"Modern Living Room": "https://corsproxy.io/?https://images.unsplash.com/photo-1586023492125-27b2c045efd7",
"Minimalist Bedroom": "https://corsproxy.io/?https://images.unsplash.com/photo-1522771739844-6a9f6d5f14af",
"Home Office": "https://corsproxy.io/?https://images.unsplash.com/photo-1486946255434-2466348c2166"
}
if uploaded_file:
# Display original image
st.subheader("Original Room")
image = Image.open(uploaded_file)
st.image(image, use_column_width=True)
# Let user select a furniture layout
selected_layout = st.selectbox(
"Select a furniture layout style",
list(furniture_layouts.keys())
)
st.subheader("Sample Furnished Layout")
# Display sample furnished room based on selection
try:
# NOTE: Using corsproxy.io because we're in a WASM environment. If running locally,
# you can remove the corsproxy.io prefix. Some websites don't work with the proxy,
# in those cases try removing the proxy prefix.
response = requests.get(furniture_layouts[selected_layout])
sample_image = Image.open(io.BytesIO(response.content))
st.image(sample_image, use_column_width=True)
st.info("""
Note: This is a demo showing sample furnished rooms.
A full version would use AI to actually add furniture to your uploaded image.
""")
except Exception as e:
st.error("Error loading the sample image. Please try again.")
else:
st.info("Please upload an image to get started")
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?