Skip to content

Instantly share code, notes, and snippets.

@hpssjellis
Forked from anonymous/html
Last active November 15, 2017 21:33
Show Gist options
  • Save hpssjellis/05af4e9e3e11f6e38b40b412926fa7cc to your computer and use it in GitHub Desktop.
Save hpssjellis/05af4e9e3e11f6e38b40b412926fa7cc to your computer and use it in GitHub Desktop.

Revisions

  1. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 1 addition and 20 deletions.
    21 changes: 1 addition & 20 deletions html
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ but then how to re-activate the script. It does not seem to have a way to call i

    <input id="myFile" type=file size=100 onchange="{
    document.getElementById('cat').onload = function() {
    context.drawImage(document.getElementById('cat').img, 400, 400);
    context.drawImage(document.getElementById('cat'), 400, 400);
    };
    document.getElementById('cat').crossOrigin = 'Use-Credentials';
    document.getElementById('myFile01').value = this.value
    @@ -42,24 +42,5 @@ but then how to re-activate the script. It does not seem to have a way to call i


    <div id="myDivOut">...</div>
    <input type=button value=try onclick="{
    document.getElementById('myDivOut').innerHTML = '' // clear the div
    document.getElementById('cat').outerHTML = '<img id=\'cat\' src=\'https://www.what-dog.net/Images/faces2/scroll001.jpg\' width=227 height=227 crossorigin >'
    }">




    <script>

    var context = document.getElementById('canvas1').getContext("2d");

    var img = new Image();
    img.onload = function () {
    context.drawImage(img, 0, 0);
    }
    img.src = "https://www.what-dog.net/Images/faces2/scroll001.jpg";

    </script>


  2. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions html
    Original file line number Diff line number Diff line change
    @@ -50,7 +50,7 @@ but then how to re-activate the script. It does not seem to have a way to call i




    <script>

    var context = document.getElementById('canvas1').getContext("2d");

    @@ -60,6 +60,6 @@ img.onload = function () {
    }
    img.src = "https://www.what-dog.net/Images/faces2/scroll001.jpg";


    </script>


  3. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions html
    Original file line number Diff line number Diff line change
    @@ -47,3 +47,19 @@ but then how to re-activate the script. It does not seem to have a way to call i
    document.getElementById('cat').outerHTML = '<img id=\'cat\' src=\'https://www.what-dog.net/Images/faces2/scroll001.jpg\' width=227 height=227 crossorigin >'
    }">






    var context = document.getElementById('canvas1').getContext("2d");

    var img = new Image();
    img.onload = function () {
    context.drawImage(img, 0, 0);
    }
    img.src = "https://www.what-dog.net/Images/faces2/scroll001.jpg";




  4. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion html
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ but then how to re-activate the script. It does not seem to have a way to call i
    <script src='https://unpkg.com/deeplearn-squeezenet'></script>

    <img id='cat' src='https://storage.googleapis.com/learnjs-data/images/cat.jpeg' width=227 height=227 crossorigin ><br><br>
    use

    <input id="myFile" type=file size=100 onchange="{
    document.getElementById('cat').onload = function() {
    context.drawImage(document.getElementById('cat').img, 400, 400);
  5. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion html
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,9 @@ but then how to re-activate the script. It does not seem to have a way to call i
    <img id='cat' src='https://storage.googleapis.com/learnjs-data/images/cat.jpeg' width=227 height=227 crossorigin ><br><br>
    use
    <input id="myFile" type=file size=100 onchange="{

    document.getElementById('cat').onload = function() {
    context.drawImage(document.getElementById('cat').img, 400, 400);
    };
    document.getElementById('cat').crossOrigin = 'Use-Credentials';
    document.getElementById('myFile01').value = this.value
    document.getElementById('cat').src = this.value
  6. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions html
    Original file line number Diff line number Diff line change
    @@ -11,10 +11,12 @@ but then how to re-activate the script. It does not seem to have a way to call i
    <script src='https://unpkg.com/deeplearn-squeezenet'></script>

    <img id='cat' src='https://storage.googleapis.com/learnjs-data/images/cat.jpeg' width=227 height=227 crossorigin ><br><br>

    use
    <input id="myFile" type=file size=100 onchange="{
    document.getElementById('myFile01').value = this.value
    document.getElementById('cat').src = this.value

    document.getElementById('cat').crossOrigin = 'Use-Credentials';
    document.getElementById('myFile01').value = this.value
    document.getElementById('cat').src = this.value

    }">

  7. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions html
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,7 @@ but then how to re-activate the script. It does not seem to have a way to call i

    <input id="myFile" type=file size=100 onchange="{
    document.getElementById('myFile01').value = this.value
    document.getElementById('cat').src = this.value

    }">

  8. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions html
    Original file line number Diff line number Diff line change
    @@ -9,10 +9,13 @@ but then how to re-activate the script. It does not seem to have a way to call i


    <script src='https://unpkg.com/deeplearn-squeezenet'></script>
    try

    <img id='cat' src='https://storage.googleapis.com/learnjs-data/images/cat.jpeg' width=227 height=227 crossorigin ><br><br>

    <input id="myFile" type=file size=100 onclick="this.value = null;" onchange="{alert(this.value)}">
    <input id="myFile" type=file size=100 onchange="{
    document.getElementById('myFile01').value = this.value

    }">



  9. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions html
    Original file line number Diff line number Diff line change
    @@ -9,10 +9,10 @@ but then how to re-activate the script. It does not seem to have a way to call i


    <script src='https://unpkg.com/deeplearn-squeezenet'></script>

    try
    <img id='cat' src='https://storage.googleapis.com/learnjs-data/images/cat.jpeg' width=227 height=227 crossorigin ><br><br>

    <input id="myFile" type=file size=100 onclick="this.value = null;" onchange="{alert(this.value)}">
    <input id="myFile" type=file size=100 onclick="this.value = null;" onchange="{alert(this.value)}">



  10. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion html
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ but then how to re-activate the script. It does not seem to have a way to call i

    <img id='cat' src='https://storage.googleapis.com/learnjs-data/images/cat.jpeg' width=227 height=227 crossorigin ><br><br>

    <input id="myFile" type=file size=100 onchange="{alert()}">
    <input id="myFile" type=file size=100 onclick="this.value = null;" onchange="{alert(this.value)}">



  11. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions html
    Original file line number Diff line number Diff line change
    @@ -8,15 +8,15 @@ https://www.what-dog.net/Images/faces2/scroll001.jpg <br>
    but then how to re-activate the script. It does not seem to have a way to call it<br>


    <script src='https://unpkg.com/deeplearn-squeezenet'></script>

    <img id='cat' src='https://storage.googleapis.com/learnjs-data/images/cat.jpeg' width=227 height=227 crossorigin ><br><br>

    <input id="myFile" type=file size=100 onchange="{alert()}">




    <script src='https://unpkg.com/deeplearn-squeezenet'></script>

    <img id='cat' src='https://storage.googleapis.com/learnjs-data/images/cat.jpeg' width=227 height=227 crossorigin ><br><br>


    <input id="myFile01" type=text size=100 value='https://storage.googleapis.com/learnjs-data/images/cat.jpeg' onChange="{
  12. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion html
    Original file line number Diff line number Diff line change
    @@ -36,6 +36,6 @@ but then how to re-activate the script. It does not seem to have a way to call i
    <div id="myDivOut">...</div>
    <input type=button value=try onclick="{
    document.getElementById('myDivOut').innerHTML = '' // clear the div
    document.getElementById('cat').outerHTML = '<img id='cat' src='https://www.what-dog.net/Images/faces2/scroll001.jpg' width=227 height=227 crossorigin >'
    document.getElementById('cat').outerHTML = '<img id=\'cat\' src=\'https://www.what-dog.net/Images/faces2/scroll001.jpg\' width=227 height=227 crossorigin >'
    }">

  13. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion html
    Original file line number Diff line number Diff line change
    @@ -35,6 +35,7 @@ but then how to re-activate the script. It does not seem to have a way to call i

    <div id="myDivOut">...</div>
    <input type=button value=try onclick="{
    myCall()
    document.getElementById('myDivOut').innerHTML = '' // clear the div
    document.getElementById('cat').outerHTML = '<img id='cat' src='https://www.what-dog.net/Images/faces2/scroll001.jpg' width=227 height=227 crossorigin >'
    }">

  14. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 0 additions and 8 deletions.
    8 changes: 0 additions & 8 deletions js
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,4 @@
    // finishes the async function
    }

    async function myCall(){
    const catImage = document.getElementById('cat');
    const math = new dl.NDArrayMathGPU();
    const squeezeNet = new squeezenet.SqueezeNet(math);
    @@ -16,8 +13,3 @@ for (const className in topClassesToProbs) {
    document.getElementById('myDivOut').innerHTML += topClassesToProbs[className].toFixed(5) + ' : '+ className + '<br>'
    }

    }


    function nothing(){
    // closes the final bracket
  15. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions js
    Original file line number Diff line number Diff line change
    @@ -16,5 +16,8 @@ for (const className in topClassesToProbs) {
    document.getElementById('myDivOut').innerHTML += topClassesToProbs[className].toFixed(5) + ' : '+ className + '<br>'
    }

    }


    function nothing(){
    // closes the final bracket
  16. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    // finishes the async function
    }

    async function myCall(){
    const catImage = document.getElementById('cat');
    @@ -13,4 +15,6 @@ document.getElementById('myDivOut').innerHTML = '' // clear the div
    for (const className in topClassesToProbs) {
    document.getElementById('myDivOut').innerHTML += topClassesToProbs[className].toFixed(5) + ' : '+ className + '<br>'
    }
    }

    function nothing(){
    // closes the final bracket
  17. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@

    function myCall(){
    async function myCall(){
    const catImage = document.getElementById('cat');
    const math = new dl.NDArrayMathGPU();
    const squeezeNet = new squeezenet.SqueezeNet(math);
  18. hpssjellis revised this gist Nov 15, 2017. 2 changed files with 6 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions html
    Original file line number Diff line number Diff line change
    @@ -34,4 +34,7 @@ but then how to re-activate the script. It does not seem to have a way to call i


    <div id="myDivOut">...</div>
    <input type=button value=try onclick="{
    myCall()
    }">

    3 changes: 3 additions & 0 deletions js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@

    function myCall(){
    const catImage = document.getElementById('cat');
    const math = new dl.NDArrayMathGPU();
    const squeezeNet = new squeezenet.SqueezeNet(math);
    @@ -10,4 +12,5 @@ const topClassesToProbs = await squeezeNet.getTopKClasses(inferenceResult.logits
    document.getElementById('myDivOut').innerHTML = '' // clear the div
    for (const className in topClassesToProbs) {
    document.getElementById('myDivOut').innerHTML += topClassesToProbs[className].toFixed(5) + ' : '+ className + '<br>'
    }
    }
  19. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion html
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,9 @@ Trying to dynamically load an image but running into corssorigin issues.
    Have had some suuccess with <br>
    //https://crossorigin.me/your-URL<br><br>

    https://www.what-dog.net/Images/faces2/scroll001.jpg
    https://www.what-dog.net/Images/faces2/scroll001.jpg <br>

    but then how to re-activate the script. It does not seem to have a way to call it<br>



  20. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion html
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,13 @@
    <h1 align=center>SqueezeNet Cat Demo</h1>
    Trying to dynamically load an image but running into corssorigin issues.
    Have had some suuccess with <br>
    //https://crossorigin.me/your-URL<br>
    //https://crossorigin.me/your-URL<br><br>

    https://www.what-dog.net/Images/faces2/scroll001.jpg







  21. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 8 additions and 4 deletions.
    12 changes: 8 additions & 4 deletions html
    Original file line number Diff line number Diff line change
    @@ -12,10 +12,14 @@ Have had some suuccess with <br>


    <input id="myFile01" type=text size=100 value='https://storage.googleapis.com/learnjs-data/images/cat.jpeg' onChange="{
    document.getElementById('cat').onload = function() {
    context.drawImage(this, 40, 40);
    };
    document.getElementById('cat').crossOrigin = 'Anonymous';
    // document.getElementById('cat').onload = function() {
    // context.drawImage(this, 40, 40);
    //};
    // document.getElementById('cat').crossOrigin = 'Anonymous';

    document.getElementById('cat').crossOrigin = 'Use-Credentials';


    document.getElementById('cat').src = this.value
    document.getElementById('myDivOut').innerHTML = '' // clear the div
    }"><br><br>
  22. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions html
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,9 @@ Have had some suuccess with <br>


    <input id="myFile01" type=text size=100 value='https://storage.googleapis.com/learnjs-data/images/cat.jpeg' onChange="{
    document.getElementById('cat').onload = function() {
    context.drawImage(this, 40, 40);
    };
    document.getElementById('cat').crossOrigin = 'Anonymous';
    document.getElementById('cat').src = this.value
    document.getElementById('myDivOut').innerHTML = '' // clear the div
  23. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions html
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,9 @@
    <h1 align=center>SqueezeNet Cat Demo</h1>
    Trying to dynamically load an image but running into corssorigin issues.
    Have had some suuccess with <br>
    //https://crossorigin.me/your-URL<br>




    <script src='https://unpkg.com/deeplearn-squeezenet'></script>
  24. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion html
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@


    <input id="myFile01" type=text size=100 value='https://storage.googleapis.com/learnjs-data/images/cat.jpeg' onChange="{
    document.getElementById('cat').crossOrigin = "Anonymous";
    document.getElementById('cat').crossOrigin = 'Anonymous';
    document.getElementById('cat').src = this.value
    document.getElementById('myDivOut').innerHTML = '' // clear the div
    }"><br><br>
  25. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion html
    Original file line number Diff line number Diff line change
    @@ -7,8 +7,8 @@


    <input id="myFile01" type=text size=100 value='https://storage.googleapis.com/learnjs-data/images/cat.jpeg' onChange="{
    document.getElementById('cat').src = this.value
    document.getElementById('cat').crossOrigin = "Anonymous";
    document.getElementById('cat').src = this.value
    document.getElementById('myDivOut').innerHTML = '' // clear the div
    }"><br><br>

  26. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions html
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,7 @@

    <input id="myFile01" type=text size=100 value='https://storage.googleapis.com/learnjs-data/images/cat.jpeg' onChange="{
    document.getElementById('cat').src = this.value
    document.getElementById('cat').crossOrigin = "Anonymous";
    document.getElementById('myDivOut').innerHTML = '' // clear the div
    }"><br><br>

  27. hpssjellis revised this gist Nov 15, 2017. 2 changed files with 1 addition and 4 deletions.
    1 change: 0 additions & 1 deletion adf
    Original file line number Diff line number Diff line change
    @@ -1 +0,0 @@
    sf
    4 changes: 1 addition & 3 deletions html
    Original file line number Diff line number Diff line change
    @@ -3,9 +3,7 @@

    <script src='https://unpkg.com/deeplearn-squeezenet'></script>

    <img id='cat' src='https://storage.googleapis.com/learnjs-data/images/cat.jpeg' width=227 height=227 crossorigin onClick="{
    document.getElementById('myDivOut').innerHTML = '' // clear the div
    }"><br><br>
    <img id='cat' src='https://storage.googleapis.com/learnjs-data/images/cat.jpeg' width=227 height=227 crossorigin ><br><br>


    <input id="myFile01" type=text size=100 value='https://storage.googleapis.com/learnjs-data/images/cat.jpeg' onChange="{
  28. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions adf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    sf
  29. hpssjellis revised this gist Nov 15, 2017. No changes.
  30. hpssjellis revised this gist Nov 15, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions js
    Original file line number Diff line number Diff line change
    @@ -7,6 +7,7 @@ const image = dl.Array3D.fromPixels(catImage);
    const inferenceResult = await squeezeNet.predict(image);

    const topClassesToProbs = await squeezeNet.getTopKClasses(inferenceResult.logits, 10);
    document.getElementById('myDivOut').innerHTML = '' // clear the div
    for (const className in topClassesToProbs) {
    document.getElementById('myDivOut').innerHTML += topClassesToProbs[className].toFixed(5) + ' : '+ className + '<br>'
    }