I built a web app using Deno, Fresh, and TensorFlowJS to classify images as links or buttons. The app uses a pre-trained ML model and allows users to drag and drop multiple images for classification. I encountered challenges with server-side rendering and islands, specifically with integrating a file-drop web component. I also documented the process of integrating the TensorFlowJS model, including model loading and prediction handling. The code is available on GitHub.
file-drop custom element
A simple drag and drop custom element that accepts files
Web sites as unintended silos: The problem with getting data in and out of the web client
It's nearly impossible to get consistent get data in and out of a web app on the client
Drag to Desktop in JS
In appmator, I wanted to avoid traditional web elements like 'Save As' buttons. Instead, I implemented a drag-to-desktop feature using Chrome's drag-and-drop functionality. By setting a 'DownloadURL' with a data URI or regular URL on the 'dragstart' event, users can drag data directly to their desktop. This method bypasses the need for a save button. The code example demonstrates how to use the dataTransfer.setData()
method with the DownloadURL
type. It leverages the JSZip
library to generate ZIP files as data URIs for dragging. This approach is Chrome-specific and has no feature detection available.