This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# on local machine | |
git clone https://github.com/comfyanonymous/ComfyUI | |
cd ComfyUI/custom_nodes | |
git clone https://github.com/ltdrdata/ComfyUI-Manager.git | |
cd ../ | |
# start docker | |
docker run --name comfyui -p 8188:8188 -it --rm --gpus all -v $PWD:/workspace pytorch/pytorch:2.2.1-cuda12.1-cudnn8-devel bash | |
apt-get update | |
apt-get install wget git libgl1 libglib2.0-0 -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Code mostly written by GPT-4. Works well for me, but not extensively tested (e.g. on old or weird jpeg files) | |
function removeExifFromJpeg(arrayBuffer) { | |
let view = new DataView(arrayBuffer); | |
// Check if it's a JPEG file | |
if (view.getUint16(0, false) !== 0xFFD8) { | |
throw new Error("Not a valid JPEG"); | |
} | |
let position = 2; // Start after the SOI marker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See the comments at the end for a model that does much better than e5-large-v2 while being a third of the size. | |
let { pipeline } = await import('https://cdn.jsdelivr.net/npm/@xenova/transformers@2.7.0'); | |
let extractor = await pipeline('feature-extraction', 'Xenova/e5-large-v2'); | |
// Note: If you're just comparing "passages" with one another, then just prepend "passage: " to all texts. Only use "query: " if the text is a short "search query" like in the above example. | |
let passage1 = await extractor(`passage: The Shawshank Redemption is a true masterpiece of cinema.`, { pooling: 'mean', normalize: true }); | |
let passage2 = await extractor(`passage: The film should not be exposed to sunlight when removing it from the wrapper. Otherwise your movie will come out bad.`, { pooling: 'mean', normalize: true }); | |
let query = await extractor(`query: movie review`, { pooling: 'mean', normalize: true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a version of this file: https://w3c.github.io/webcodecs/samples/capture-to-file/webm-writer2.js | |
// With these fixed applied: https://github.com/w3c/webcodecs/issues/332#issuecomment-1077442192 | |
/** | |
* A tool for presenting an ArrayBuffer as a stream for writing some simple data | |
* types. | |
* | |
* By Nicholas Sherlock, with updates from jimbankoski | |
* | |
* - make it work off frames with timestamps from webcodecs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function createCanvasFromRGBAData(data, width, height) { | |
// `data` should look something like [[123,32,40,255], [3,233,42,120], ...] | |
if(width*height !== data.length) throw new Error("width*height should equal data.length"); | |
let canvas = document.createElement("canvas"); | |
canvas.width = width; | |
canvas.height = height; | |
let ctx = canvas.getContext("2d"); | |
let imgData = ctx.createImageData(width, height); | |
for(let i = 0; i < data.length; i++) { | |
imgData.data[i*4+0] = data[i][0]; |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as AWS from "./aws_sdk_client_s3_v3.198.0-es.js"; | |
let s3 = new AWS.S3({ | |
region: "YOUR_REGION", | |
endpoint: "YOUR_ENDPOINT_URL_IF_NECCESSARY", | |
credentials: { | |
accessKeyId: "YOUR_ACCESS_KEY", | |
secretAccessKey: "YOUR_SECRET", | |
}, | |
}); |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder