hub
hub copied to clipboard
False positive CORS issue happening because hub is returning 404 when fetching the model
What happened?
Suddenly I'm getting false positive CORS errors when starting face detection.
Access to fetch at 'https://www.kaggle.com/models/mediapipe/face-landmarks-detection/tfJs/attention-mesh/1/model.json?tfjs-format=file&tfhub-redirect=true' (redirected from 'https://tfhub.dev/mediapipe/tfjs-model/face_landmarks_detection/attention_mesh/1/model.json?tfjs-format=file') from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
If I try to access the hub link directly (https://tfhub.dev/mediapipe/tfjs-model/face_landmarks_detection/attention_mesh/1/model.json?tfjs-format=file), it redirects me to (https://www.kaggle.com/models/mediapipe/face-landmarks-detection/tfJs/attention-mesh/1/model.json?tfjs-format=file&tfhub-redirect=true), which returns me 404
Relevant code
await tf.setBackend('webgl')
const model = faceLandmarksDetection.SupportedModels.MediaPipeFaceMesh
const detector = await faceLandmarksDetection.createDetector(model, {
runtime: 'tfjs',
refineLandmarks: true,
maxFaces: 1,
})
Relevant log output
Access to fetch at 'https://www.kaggle.com/models/mediapipe/face-landmarks-detection/tfJs/attention-mesh/1/model.json?tfjs-format=file&tfhub-redirect=true' (redirected from 'https://tfhub.dev/mediapipe/tfjs-model/face_landmarks_detection/attention_mesh/1/model.json?tfjs-format=file') from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.Understand this errorAI
www.kaggle.com/models/mediapipe/face-landmarks-detection/tfJs/attention-mesh/1/model.json?tfjs-format=file&tfhub-redirect=true:1
Failed to load resource: net::ERR_FAILED
tensorflow_hub Version
0.13.0.dev (unstable development build)
TensorFlow Version
2.8 (latest stable release)
Other libraries
"@mediapipe/face_mesh": "^0.4.1633559619",
"@tensorflow-models/face-landmarks-detection": "^1.0.6",
"@tensorflow-models/handpose": "^0.1.0",
"@tensorflow/tfjs": "^4.22.0",
"@tensorflow/tfjs-converter": "^4.22.0",
"@tensorflow/tfjs-core": "^4.22.0",
Python Version
3.x
OS
macOS