tensorflow / hub

A library for transfer learning by reusing parts of TensorFlow models.
https://tensorflow.org/hub
Apache License 2.0
3.49k stars 1.67k forks source link

Bug: Getting CORS issue in getting facemesh model.json #902

Closed himi1203 closed 7 months ago

himi1203 commented 9 months ago

What happened?

Getting CORS error in local as well as hosted environment -

Access to fetch at 'https://tfhub.dev/mediapipe/tfjs-model/iris/1/default/2/model.json?tfjs-format=file' from origin 'http://localhost:3000' has been blocked by CORS policy

Relevant code

import * as faceLandmarksDetection from "@tensorflow-models/face-landmarks-detection";
import * as tf from "@tensorflow/tfjs-core";
require("@tensorflow/tfjs-backend-webgl");

Relevant log output

Access to fetch at 'https://tfhub.dev/mediapipe/tfjs-model/iris/1/default/2/model.json?tfjs-format=file' from origin 'http://localhost:3000' has been blocked by CORS policy

tensorflow_hub Version

0.13.0.dev (unstable development build)

TensorFlow Version

2.8 (latest stable release)

Other libraries

No response

Python Version

3.x

OS

Linux

KeijiBranshi commented 9 months ago

Hi @himi1203. Thanks for posting.

I'm having trouble reproducing this issue though. I don't see a CORS issue for the model resource on my hosted or local environment.

Can you share a code fiddle that roughly mirrors your use-case? For example, here's my demo:

https://stackblitz.com/edit/vitejs-vite-rhhqe8?file=index.html

Let me know if that link works okay for you.

Thanks!

KeijiBranshi commented 7 months ago

Going to close and consolidate this thread into #904. Added some investigation notes over there. Thanks again for reporting this!

google-ml-butler[bot] commented 7 months ago

Are you satisfied with the resolution of your issue? Yes No