Shapes.
Reconocimiento de formas en el dispositivo que convierte un trazo a mano en rectángulo, elipse, triángulo, estrella o línea en menos de 10 ms.
Demo
Trazo a mano. Forma perfecta.
Dibuja un círculo aproximado y Shapes lo ajusta a uno limpio. Shapes crea geometría vectorial precisa, ajusta a ejes, círculos, cuadrados y rotaciones de 15 grados, y rechaza los garabatos que no son formas.
En Apple, una sola llamada añade a un lienzo de PencilKit el ajuste inteligente de formas al estilo de Notas, y la vista previa en vivo se mantiene. El «Snap to Shape» de Apple es una API privada que las apps de terceros no pueden invocar, así que Shapes hace el mismo trabajo en una línea.
El modelo es lo bastante pequeño como para ir dentro de la app, sin descarga. En el navegador, Shapes se ejecuta con LiteRT.js.
Menos de 10 ms por trazo.
Menos de 10 ms por trazo, desde un modelo de 0,2 MB en Apple y de 1,3 MB en Android y web.
Mediciones internas. Core ML en Apple, LiteRT.js en el navegador y bibliotecas nativas precompiladas en Node.
Formas inteligentes al estilo de Notas
Añade el ajuste a formas a un lienzo de PencilKit con canvasView.enableShapeSnapping(). Se conservan la vista previa en vivo, deshacer y rehacer, y se cubre el hueco que deja la API privada Snap to Shape de Apple.
Pasa a limpio un diagrama a mano alzada
Convierte los trazos toscos en geometría precisa dentro de una herramienta de diagramas o de pizarra. Funciona con los datos de trazo de tldraw y Excalidraw.
Dibujo multiplataforma
Un único reconocedor cubre iOS, Android y la web, así que el código de ajuste lo escribes una vez.
Va dentro de la app, no como descarga
En Apple el reconocedor ocupa 0,2 MB y se incluye dentro del binario, y el paquete de Android lo integra por defecto. En el navegador el SDK descarga 1,3 MB una vez y los guarda en caché.
Inspiración
Ideas para crear con Shapes. Copia un prompt en tu agente de código y adelante.
Build a whiteboard that snaps rough sketches into clean shapes.
Build a drawing canvas where a freehand stroke is passed to Desert Ant's Shapes on-device and snapped to a clean rectangle, ellipse, triangle, star, or line in under 10ms. Keep the ink as an undo. Works offline. Build it with the Desert Ant SDK. Shapes (Swift, Kotlin, JavaScript / TypeScript). Install and API: https://desertant.com/docs/shapes/. Install: SwiftPM desert-ant-core; Maven ai.desertant:shapes:3.1.0; npm i @desert-ant-labs/shapes @litertjs/core. SDK source: https://github.com/Desert-Ant-Labs/desert-ant-core. Machine-readable catalog of every model and SDK: https://desertant.com/llms.txt.
Clean up a freehand diagram into crisp shapes.
In a diagramming tool, run Desert Ant's Shapes on each stroke to convert rough sketches into clean geometry as the user draws. Build it with the Desert Ant SDK. Shapes (Swift, Kotlin, JavaScript / TypeScript). Install and API: https://desertant.com/docs/shapes/. Install: SwiftPM desert-ant-core; Maven ai.desertant:shapes:3.1.0; npm i @desert-ant-labs/shapes @litertjs/core. SDK source: https://github.com/Desert-Ant-Labs/desert-ant-core. Machine-readable catalog of every model and SDK: https://desertant.com/llms.txt.
Add shape recognition to a web canvas with no download.
Add Desert Ant's Shapes to a browser drawing app (WebAssembly), so a hand-drawn stroke snaps to a clean shape with nothing to download and no server. Build it with the Desert Ant SDK. Shapes (Swift, Kotlin, JavaScript / TypeScript). Install and API: https://desertant.com/docs/shapes/. Install: SwiftPM desert-ant-core; Maven ai.desertant:shapes:3.1.0; npm i @desert-ant-labs/shapes @litertjs/core. SDK source: https://github.com/Desert-Ant-Labs/desert-ant-core. Machine-readable catalog of every model and SDK: https://desertant.com/llms.txt.
Snap flowchart boxes and connector lines as you sketch them.
In a diagram or flowchart tool, run Desert Ant's Shapes on each stroke so hand-drawn boxes and connector lines snap to clean geometry live. (Add your own arrowheads on a recognized line.) Build it with the Desert Ant SDK. Shapes (Swift, Kotlin, JavaScript / TypeScript). Install and API: https://desertant.com/docs/shapes/. Install: SwiftPM desert-ant-core; Maven ai.desertant:shapes:3.1.0; npm i @desert-ant-labs/shapes @litertjs/core. SDK source: https://github.com/Desert-Ant-Labs/desert-ant-core. Machine-readable catalog of every model and SDK: https://desertant.com/llms.txt.
Add smart-shape drawing to a kids' learning app.
Use Desert Ant's Shapes on-device so a child's rough drawing of a circle or triangle snaps to a clean shape, teaching by doing. Works offline. Build it with the Desert Ant SDK. Shapes (Swift, Kotlin, JavaScript / TypeScript). Install and API: https://desertant.com/docs/shapes/. Install: SwiftPM desert-ant-core; Maven ai.desertant:shapes:3.1.0; npm i @desert-ant-labs/shapes @litertjs/core. SDK source: https://github.com/Desert-Ant-Labs/desert-ant-core. Machine-readable catalog of every model and SDK: https://desertant.com/llms.txt.
Recognize gesture shapes to trigger app actions.
Use Desert Ant's Shapes to turn a drawn gesture (a circle, a triangle) into an app action, recognized on-device in under 10ms. Build it with the Desert Ant SDK. Shapes (Swift, Kotlin, JavaScript / TypeScript). Install and API: https://desertant.com/docs/shapes/. Install: SwiftPM desert-ant-core; Maven ai.desertant:shapes:3.1.0; npm i @desert-ant-labs/shapes @litertjs/core. SDK source: https://github.com/Desert-Ant-Labs/desert-ant-core. Machine-readable catalog of every model and SDK: https://desertant.com/llms.txt.
Qué hace el modelo
- Un trazo cada vez, pasado como sus puntos
[x, y], desde PencilKit, tldraw, Excalidraw o tu propio lienzo. - Reconoce rectángulo, elipse, triángulo, estrella y línea, y rechaza lo que no es una forma.
- Ajusta a ejes, círculos, cuadrados y rotaciones de 15 grados.
- Ajuste en vivo en PencilKit con una sola llamada:
canvasView.enableShapeSnapping(). - Se ejecuta con LiteRT.js en el navegador. Node usa bibliotecas nativas precompiladas.
Primeros pasos
Añade reconocimiento de formas a tu app de iOS or macOS, Android or web con unas pocas líneas de código. Docs de Shapes.
// Swift Package Manager
.package(url: "https://github.com/Desert-Ant-Labs/desert-ant-core", from: "3.1.0")
// target dependency
.product(name: "Shapes", package: "desert-ant-core")
import Shapes
let shapes = Shapes()
let shape = try await shapes.recognize(points: stroke)
// Shape? -> rectangle, ellipse, triangle, star, line
import PencilKit
import Shapes
// Live smart-shape snapping on a PencilKit canvas, in one line.
// Pause after a stroke to preview the fit, lift to snap. Undo-safe,
// and it uses the same recognizer, bundled by default.
canvasView.enableShapeSnapping()
Add Shapes from Desert Ant Labs to this Swift project (iOS, macOS). What it does: reconocimiento de formas de un solo trazo en el dispositivo. SDK: Swift (iOS, macOS) Repo: https://github.com/Desert-Ant-Labs/desert-ant-core#readme // Swift Package Manager .package(url: "https://github.com/Desert-Ant-Labs/desert-ant-core", from: "3.1.0") // target dependency .product(name: "Shapes", package: "desert-ant-core") Reference: - Model page: https://desertant.com/models/shapes/ - Full catalog and other models: https://desertant.com/llms.txt Add the SDK, then follow its README for the exact API and current version. Do not invent API names or method signatures; confirm them against the README.
// build.gradle.kts (Maven Central)
implementation("ai.desertant:shapes:3.1.0")
import ai.desertant.shapes.Shapes
val shapes = Shapes(context)
val shape = shapes.recognize(points)
// Shape? -> rectangle, ellipse, triangle, star, line
Add Shapes from Desert Ant Labs to this Kotlin project (Android).
What it does: reconocimiento de formas de un solo trazo en el dispositivo.
SDK:
Kotlin (Android)
Repo: https://github.com/Desert-Ant-Labs/desert-ant-core#readme
// build.gradle.kts (Maven Central)
implementation("ai.desertant:shapes:3.1.0")
Reference:
- Model page: https://desertant.com/models/shapes/
- Full catalog and other models: https://desertant.com/llms.txt
Add the SDK, then follow its README for the exact API and current version. Do not invent API names or method signatures; confirm them against the README.
npm i @desert-ant-labs/shapes @litertjs/core
import { Shapes } from "@desert-ant-labs/shapes"; // browser
// import { Shapes } from "@desert-ant-labs/shapes/native"; // server-side Node
const shapes = await Shapes.load();
const shape = await shapes.recognize(points);
// { kind: "ellipse", center: {...}, ... } or null
Add Shapes from Desert Ant Labs to this JavaScript / TypeScript project (Web, Node.js). What it does: reconocimiento de formas de un solo trazo en el dispositivo. SDK: JavaScript / TypeScript (Web, Node.js) Repo: https://github.com/Desert-Ant-Labs/desert-ant-core#readme npm i @desert-ant-labs/shapes @litertjs/core Reference: - Model page: https://desertant.com/models/shapes/ - Full catalog and other models: https://desertant.com/llms.txt Add the SDK, then follow its README for the exact API and current version. Do not invent API names or method signatures; confirm them against the README.
Especificaciones
- Clases de formas
- Rectángulo, elipse, triángulo, estrella, línea
- Tamaño en el dispositivo
- 0,2 MB Core ML (Apple); 1,3 MB LiteRT (Android, web)
- Velocidad
- <10 ms
- Entorno de ejecución web
- LiteRT.js en el navegador, bibliotecas nativas en Node
Shapes lee un trazo cada vez, así que una forma dibujada con dos gestos no se reconoce. Los trazos muy toscos o ambiguos se rechazan a propósito, de manera que un garabato nunca acaba encajando en un triángulo.
Los diagramas de varios trazos necesitan antes tu propio paso de agrupación.
Preguntas frecuentes
¿Qué es Shapes?
Reconocimiento de formas en el dispositivo que convierte un trazo a mano en rectángulo, elipse, triángulo, estrella o línea en menos de 10 ms.
¿Shapes se ejecuta en el dispositivo?
Sí. Shapes se ejecuta en el dispositivo, sin llamadas a servidor, así que los datos se quedan con el usuario.
¿Qué plataformas admite Shapes?
Shapes se distribuye como un SDK nativo en el dispositivo para Swift, Kotlin, JavaScript / TypeScript.
¿Cuánto cuesta Shapes?
Todos los modelos son gratis hasta 100 000 dispositivos activos mensuales por SDK. Inferencia ilimitada por usuario. Contáctanos para licencias personalizadas.
¿Qué precisión o velocidad tiene Shapes?
Menos de 10 ms por trazo, desde un modelo de 0,2 MB en Apple y de 1,3 MB en Android y web.