UpscalerJS
UpscalerJS copied to clipboard
Cloudflare Worker support
This is a thread to track work related to enabling a first-class experience with UpscalerJS within a Cloudflare Worker.
Currently, the Upscaler works in a (somewhat) isolated fashion: if one uses the browser package, explicitly specifies a model, feeds a tensor in and asks for a tensor out, it works.
Unfortunately, importing @tensorflow/tfjs-node
within a Cloudflare Worker fails with Uncaught Error: EvalError: Code generation from strings disallowed for this context
, which was discussed in #124.
Importing @tensorflow/tfjs
avoids this error, but the Cloudflare Worker environment is not an exact replica of a browser; namely, browser-based APIs like Image
and ImageData
are unavailable, and binary data is provided as a Buffer
which is unsupported in the browser.
We've got three supported platforms for Upscaler that mimic Tensorflow.js's three platforms; I'd like to find a way to support the worker environment without resorting to a fourth.