JSFiddle - React, Tailwind, and code Playground

by alex_oliynyk

HTML

<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs/dist/tf.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs-backend-wasm/dist/tf-backend-wasm.js"></script>
<div>
  <h3>Setting WASM backend for tf.js is giving following error in the console</h3>
  <p>"Initialization of backend wasm failed"</p>
  <p>"Error: Failed to construct 'Worker': Access to the script at 'blob:https://fiddle.jshell.net/eb0c5b29-6555-4ab3-9c45-38056d8e563a' is denied by the document's Content Security Policy.
</p>
  <p style="position: fixed; bottom: 0;">
  <span style="display: inline-block; transform: rotate(0.5turn);">^^</span> Check the console </p>
</div>

JavaScript

(function checkWasmBackend() {
	tf.setBackend('wasm')
  .then(() => console.log('success', tf.getBackend()))
  .catch(err => console.error('Error setting WASM backend', err))
})()