bailey_new_stream / streamlit.py
baileydiaz
here we go!
1e4b03e
raw
history blame contribute delete
786 Bytes
import streamlit as st
from streamlit_drawable_canvas import st_canvas
from PIL import Image
# Create a camera input widget
picture = st.camera_input("Take a picture")
if picture:
# Convert the picture to an Image object
img = Image.open(picture)
# Display the drawable canvas with the image
canvas_result = st_canvas(
fill_color="rgba(255, 165, 0, 0.3)", # Fixed fill color with some opacity
stroke_width=2,
stroke_color="black",
background_image=img,
update_streamlit=True,
height=img.height,
width=img.width,
drawing_mode="freedraw",
key="canvas",
)
# Display the resulting image with drawings
if canvas_result.image_data is not None:
st.image(canvas_result.image_data)