Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Intermittent CORS issues on qna model fetch #913

Open
lnsy-dev opened this issue May 20, 2024 · 0 comments
Open

Bug: Intermittent CORS issues on qna model fetch #913

lnsy-dev opened this issue May 20, 2024 · 0 comments
Labels

Comments

@lnsy-dev
Copy link

What happened?

When looking at the demo:

https://storage.googleapis.com/tfjs-models/demos/mobilebert-qna/index.html

I get the below error intermittently.

This error is replicated when I implement the demo code found here also: https://github.com/tensorflow/tfjs-models/tree/master/qna

This error might be related to https://discuss.tensorflow.org/t/tensorflow-model-cors-issues/18503

Relevant code

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Load TensorFlow.js. This is required to use the qna model. -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"> </script>
<!-- Load the qna model. -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/qna"> </script>

<!-- Place your code in the script tag below. You can also use an external .js file -->
<script>
  // Notice there is no 'import' statement. 'qna' and 'tf' is
  // available on the index-page because of the script tag above.

  // Load the model.
  qna.load().then(model => {
    // Find the answers
    model.findAnswers(question, passage).then(answers => {
      console.log('Answers: ', answers);
    });
  });
</script>

Relevant log output

Access to fetch at 'https://www.kaggle.com/models/tensorflow/mobilebert/tfJs/mobilebert/1/model.json?tfjs-format=file&tfhub-redirect=true' (redirected from 'https://tfhub.dev/tensorflow/tfjs-model/mobilebert/1/model.json?tfjs-format=file') from origin 'https://storage.googleapis.com' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://storage.googleapis.com' that is not equal to the supplied origin. 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.

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

macOS

@lnsy-dev lnsy-dev changed the title Bug: CORS issues on qna model fetch Bug: Intermittent CORS issues on qna model fetch May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant