I need help with uploading a pretrained Keras model to my existing tensorflow.js model and then making simple predictions by passing tensors in the correct format. The model is stored locally 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've added a button in my HTML code that should trigger the prediction process and display the results in the console. However, I am encountering the following errors:
Fetching API cannot load file:///C:/Users/..path to folder../assets/tfjs_model/model.json. The URL scheme must be "http" or "https" for CORS request.
ERROR Error: Uncaught (in promise): TypeError: Failed to fetch TypeError: Failed to fetch