The tfjs-tflite library allows you to run TFLite models on the web.
Example:
const tfliteModel = await tflite.loadTFLiteModel('url/to/your/model.tflite');
or
const objectDetector = await tflite.ObjectDetector.create(
"https://storage.googleapis.com/tfhub-lite-models/tensorflow/lite-model/ssd_mobilenet_v1/1/metadata/2.tflite"
);
I’m currently working on a simple Object Detection example, which works fine for the example models that are stored on Google Cloud, but I couldn’t get it to work with a custom model stored on Github.
This gives me a CORS error:
Access to fetch at 'https://github.com/TannerGilbert/TFLite-Object-Detection-with-TFLite-Model-Maker/raw/master/model.tflite' from origin 'null' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values 'https://render.githubusercontent.com https://viewscreen.githubusercontent.com https://viewscreen-lab.githubusercontent.com', but only one is allowed. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Therefore, I wanted to ask what’s the simplest way to solve the error or perhaps what the best platform is to store your model on the web for free.
Any help is highly appreciated. Kind regards,
Gilbert Tanner