# Ml5 NetworkError

**URL:** <https://discourse.processing.org/t/ml5-networkerror/16191>\
**Category:** Libraries\
**Created:** [December 6, 2019, 10:26pm UTC](https://discourse.processing.org/t/ml5-networkerror/16191 "2019-12-06T22:26:35Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![coco](https://avatars.discourse-cdn.com/v4/letter/c/8797f3/32.png) [@coco](https://discourse.processing.org/u/coco)\
**Post date:** [December 6, 2019, 10:26pm UTC](https://discourse.processing.org/t/ml5-networkerror/16191/1 "2019-12-06T22:26:35Z")

</div>

I’m trying to get the Image Classifier demo to work (using a local server) but I keep getting a “NetworkError when attempting to fetch resource” error…

> **[ml5js/ml5-examples](https://github.com/ml5js/ml5-examples/tree/master/p5js/ImageClassification/ImageClassification)**
>
> A collection of ml5.js examples. Contribute to ml5js/ml5-examples development by creating an account on GitHub.

It apparently has something to do with CORS but I can’t seem to able to fix it.

“Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at [https://tfhub.dev/google/imagenet/mobilenet\_v2\_100\_224/classification/2/model.json?tfjs-format=file](https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/classification/2/model.json?tfjs-format=file). (Reason: CORS request did not succeed)”

Any ideas ???

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [December 7, 2019, 12:00am UTC](https://discourse.processing.org/t/ml5-networkerror/16191/2 "2019-12-07T00:00:20Z")

</div>

> [@coco](#):
>
> (Reason: CORS request did not succeed)

[yacdn.org](http://yacdn.org)

> <https://gist.github.com/GoSubRoutine/5bdec67b4f70080bfddb6c0607cb6c70>
>
> There are more than three files. show original

> <https://gist.github.com/GoSubRoutine/5bdec67b4f70080bfddb6c0607cb6c70>
>
> There are more than three files. show original

---

<div class="post-metadata">

**Author:** ![coco](https://avatars.discourse-cdn.com/v4/letter/c/8797f3/32.png) [@coco](https://discourse.processing.org/u/coco)\
**Post date:** [December 8, 2019, 11:47am UTC](https://discourse.processing.org/t/ml5-networkerror/16191/3 "2019-12-08T11:47:35Z")

</div>

I realize that it is a CORS issue but I can’t fix it.

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at [https://tfhub.dev/google/imagenet/mobilenet\_v2\_100\_224/classification/2/model.json?tfjs-format=file](https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/classification/2/model.json?tfjs-format=file). (Reason: CORS request did not succeed).

if i try to go to  
[https://tfhub.dev/google/imagenet/mobilenet\_v2\_100\_224/classification/2/model.json?tfjs-format=file](https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/classification/2/model.json?tfjs-format=file)  
i get “We’re having trouble finding that site.”

Any ideas ?

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [December 8, 2019, 12:16pm UTC](https://discourse.processing.org/t/ml5-networkerror/16191/4 "2019-12-08T12:16:32Z")

</div>

here ok ( using the p5.js online editor )

```auto
let test;
let url = 'https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/classification/2/model.json?tfjs-format=file';

function preload() {
  test = loadJSON(url);
}

function setup() {
  print(test);
}

function draw() {
}

```

also can see it in win 10 / firefox and chrome browser  
but i have also the firefox

# CORS Everywhere

extension installed, but not needed here.

---

<div class="post-metadata">

**Author:** ![coco](https://avatars.discourse-cdn.com/v4/letter/c/8797f3/32.png) [@coco](https://discourse.processing.org/u/coco)\
**Post date:** [December 8, 2019, 12:29pm UTC](https://discourse.processing.org/t/ml5-networkerror/16191/5 "2019-12-08T12:29:05Z")

</div>

Thanks but using your test I still get :

GET [https://tfhub.dev/google/imagenet/mobilenet\_v2\_100\_224/classification/2/model.json?tfjs-format=file](https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/classification/2/model.json?tfjs-format=file) net::ERR\_NAME\_NOT\_RESOLVED

does this mean the mobilenet server is down ?  
is anyone else having the same problem ?

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [December 8, 2019, 10:20pm UTC](https://discourse.processing.org/t/ml5-networkerror/16191/6 "2019-12-08T22:20:37Z")

</div>

When you hit that url, you get redirected to [https://storage.googleapis.com/tfhub-tfjs-modules/google/imagenet/mobilenet\_v2\_100\_224/classification/2/model.json](https://storage.googleapis.com/tfhub-tfjs-modules/google/imagenet/mobilenet_v2_100_224/classification/2/model.json)

Kf

---

<div class="post-metadata">

**Author:** ![coco](https://avatars.discourse-cdn.com/v4/letter/c/8797f3/32.png) [@coco](https://discourse.processing.org/u/coco)\
**Post date:** [December 9, 2019, 7:13am UTC](https://discourse.processing.org/t/ml5-networkerror/16191/7 "2019-12-09T07:13:25Z")

</div>

but it doesn’t redirect

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [December 10, 2019, 5:58am UTC](https://discourse.processing.org/t/ml5-networkerror/16191/8 "2019-12-10T05:58:10Z")

</div>

The following code produces the same output as from this link:  
[https://storage.googleapis.com/tfhub-tfjs-modules/google/imagenet/mobilenet\_v2\_100\_224/classification/2/model.json](https://storage.googleapis.com/tfhub-tfjs-modules/google/imagenet/mobilenet_v2_100_224/classification/2/model.json)

```auto
let test;
let done=false; //Ensures text is only printed once per click

function preload() {
  let url = 'https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/classification/2/model.json?tfjs-format=file';
  
  //REFERENCE httpGET: https://p5js.org/reference/#/p5/httpGet
  httpGet(url, 'text', false, function(response) {
    test = response;
  }
  );
}

function setup() {
  createCanvas(640, 480);
}

function draw() {
  if (mouseIsPressed) {

    if (done==false) {
      fill(180);
      text("Hello " + test, width/2, height/2);
      print(test);
      done=true;
    }
  } else {
    done=false;
  }
}

```

Just inspect the console logs. Then press once in the canvas of your p5js sketch and inspect the logs and you should see there the output that you need to process.

Kf

---

<div class="post-metadata">

**Author:** ![coco](https://avatars.discourse-cdn.com/v4/letter/c/8797f3/32.png) [@coco](https://discourse.processing.org/u/coco)\
**Post date:** [December 10, 2019, 8:51am UTC](https://discourse.processing.org/t/ml5-networkerror/16191/9 "2019-12-10T08:51:13Z")

</div>

I guess what I’m trying to say is that within the ml5 library :  
[https://unpkg.com/ml5@0.4.3/dist/ml5.min.js](https://unpkg.com/ml5@0.4.3/dist/ml5.min.js)

the link to Mobilenet doesn’t work anymore :  
[https://tfhub.dev/google/imagenet/mobilenet\_v2\_100\_224/classification/2/model.json?tfjs-format=file](https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/classification/2/model.json?tfjs-format=file)

Is anyone else experiencing this problem ?
