Mobile gallery

This commit is contained in:
space-nuko
2023-05-31 19:19:23 -05:00
parent 3cd623fd20
commit 4547cc1a27
12 changed files with 167 additions and 87 deletions

View File

@@ -721,3 +721,16 @@ export async function getSafetensorsMetadata(folder: string, filename: string):
return fetch(new Request(url + `/view_metadata/${folder}?` + params)).then(r => r.json())
}
export function partition<T>(myArray: T[], chunkSize: number): T[] {
let index = 0;
const arrayLength = myArray.length;
const tempArray = [];
for (index = 0; index < arrayLength; index += chunkSize) {
const myChunk = myArray.slice(index, index + chunkSize);
tempArray.push(myChunk);
}
return tempArray;
}