diff --git a/07-llms/ollama/index.html b/07-llms/ollama/index.html index e69de29..ec45d72 100644 --- a/07-llms/ollama/index.html +++ b/07-llms/ollama/index.html @@ -0,0 +1,11 @@ + + + + + + + +
+ + + diff --git a/08-image-models/sd-webui/sketch.js b/08-image-models/sd-webui/sketch.js index d6340bc..0b38d76 100644 --- a/08-image-models/sd-webui/sketch.js +++ b/08-image-models/sd-webui/sketch.js @@ -1,3 +1,7 @@ +// Introduction to Machine Learning for the Arts, Fall 2024 +// https://github.com/ml5js/Intro-ML-Arts-IMA-F24 +// In class demonstration + let promptInput; let submitButton; let img; @@ -5,23 +9,30 @@ let loading = false; function setup() { createCanvas(400, 400); + // Input field for prompt promptInput = createInput('A land of rainbows.'); + // Button to submit prompt submitButton = createButton('generate'); submitButton.mousePressed(generateImage); } function draw() { background(220); + // Display loading text if image is being generated if (loading) { textAlign(CENTER, CENTER); text('Loading...', width / 2, height / 2); - } else if (img) { + } + // Display generated image if available + else if (img) { image(img, 0, 0, width, height); } } async function generateImage() { loading = true; + // Send POST request with user prompt to SD-webui running on ITP GPU machine + // https://github.com/AUTOMATIC1111/stable-diffusion-webui const response = await fetch('http://itp-ml.itp.tsoa.nyu.edu:7860/sdapi/v1/txt2img', { method: 'POST', headers: { @@ -32,6 +43,7 @@ async function generateImage() { }), }); + // Parse the response const data = await response.json(); img = createImg('data:image/png;base64,' + data.images[0], promptInput.value()); img.hide();