Replicate the app from the image.
To upload files, please first save the app
import streamlit as st
from PIL import Image, ImageDraw
# Set up the canvas size
canvas_width = 800
canvas_height = 600
# Create a new image with a white background and grid
image = Image.new('RGB', (canvas_width, canvas_height), 'white')
draw = ImageDraw.Draw(image)
# Draw grid lines
grid_spacing = 20
for x in range(0, canvas_width, grid_spacing):
draw.line([(x, 0), (x, canvas_height)], fill='lightgray', width=1)
for y in range(0, canvas_height, grid_spacing):
draw.line([(0, y), (canvas_width, y)], fill='lightgray', width=1)
# Draw two rectangles
# First rectangle
draw.rectangle([(200, 100), (400, 250)], outline='black', width=2)
# Second rectangle
draw.rectangle([(450, 100), (600, 220)], outline='black', width=2)
# Display the image
st.image(image)
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?