Skip to content
This repository was archived by the owner on Apr 6, 2020. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added p5js/CartoonGan/CartoonGan_Basic/MrBubz.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions p5js/CartoonGan/CartoonGan_Basic/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<html lang="en">
<head>
<title>CartoonGAN Basic</title>

<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.9.0/p5.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.9.0/addons/p5.dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.9.0/addons/p5.sound.min.js"></script>

<script src="http://localhost:8080/ml5.js" type="text/javascript"></script>
</head>

<body>
<script src="sketch.js"></script>
</body>
</html>
27 changes: 27 additions & 0 deletions p5js/CartoonGan/CartoonGan_Basic/sketch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
let cartoonGan;
let img;
let newImage;
function preload(){
img = loadImage('MrBubz.jpg');
}

function setup(){
createCanvas(256, 256);

cartoonGan = ml5.cartoon(modelLoaded)
image(img, 0,0, width, height)
}

function modelLoaded(){
cartoonGan.generate(img, gotResults)
}

function gotResults(err, result){
if(err){
return;
}
console.log(result)
image(result.image, 0,0, 256, 256);

}