I'm trying to upload a pretrained Keras model into my existing tensorflow.js model and then making a simple prediction by passing a tensor in the correct format. I'm loading the model from my local drive within the project (in the assets folder)
export class MotionAnalysisComponent implements OnInit {
model: tf.LayersModel;
ngOnInit() {
this.loadModel()
};
async loadModel() {
this.model = await
tf.loadLayersModel('C:/Users/..path to folder../assets/tfjs_model/model.json');
console.log('Prediction from loaded model:');
this.model.predict(tf.ones([60,60,60]));
}
I implemented a button in my html code, that should start the code and printing out the predictions in my console. But I'm getting the following errors:
Fetch API cannot load file:///C:/Users/..path to folder../assets/tfjs_model/model.json. URL scheme must be "http" or "https" for CORS request
ERROR Error: Uncaught (in promise): TypeError: Failed to fetch TypeError: Failed to fetch