andfanilo/streamlit-drawable-canvas
Do you like Quick, Draw? Well what if you could train/predict doodles drawn inside Streamlit? Also draws lines, circles and boxes over background images for annotation.
What it solves
It provides a way to integrate an interactive sketching canvas into Streamlit applications, allowing users to draw, annotate, and manipulate shapes directly within a web app without needing to build a custom frontend component from scratch.
How it works
Built as a Streamlit component using Fabric.js, it renders a canvas in the browser that supports various drawing modes (freedraw, lines, rectangles, circles, polygons, and text). It can be initialized with a background image or color and sends the resulting image data (as a numpy array) or object properties (as JSON) back to the Streamlit backend for further processing.
Who it’s for
Developers building Streamlit apps who need user-input for visual data, such as image annotation tools, sketching interfaces, or simple graphic editors.
Highlights
- Multiple Drawing Modes: Supports freehand drawing, points, lines, rectangles, circles, polygons, and text.
- Object Manipulation: Allows users to rotate, skew, scale, and move objects already placed on the canvas.
- Data Integration: Returns both the raw image data and detailed JSON properties of every drawn object to the Python backend.
- Annotation Support: Includes a specific
labeled_rectmode for creating labeled bounding boxes. - Customizable Backgrounds: Supports background images with options to fit via stretching or containing.
Related
- Project
- Project
- Project
- Project