Spaces:
Sleeping
Sleeping
Download src/utils/batchSizeManager.ts from codebybrody/TwistedStreamingBrody: direct link, hf CLI and curl.
- Browser
- Download file 742 Bytes
-
https://huggingface.co/spaces/codebybrody/TwistedStreamingBrody/resolve/14dbda54eabb12dff76fe0e2db1af9daa98de271/src/utils/batchSizeManager.ts
- Command line
-
hf download hf://spaces/codebybrody/TwistedStreamingBrody@14dbda54eabb12dff76fe0e2db1af9daa98de271/src/utils/batchSizeManager.ts
-
curl -L -o batchSizeManager.ts https://huggingface.co/spaces/codebybrody/TwistedStreamingBrody/resolve/14dbda54eabb12dff76fe0e2db1af9daa98de271/src/utils/batchSizeManager.ts
742 Bytes
| const BATCH_SIZE_STORAGE_KEY = 'imageBatchSize'; | |
| const DEFAULT_BATCH_SIZE = 10; | |
| export function saveBatchSize(size: number): void { | |
| if (size < 0) { | |
| throw new Error('El tamaño del lote no puede ser negativo'); | |
| } | |
| localStorage.setItem(BATCH_SIZE_STORAGE_KEY, size.toString()); | |
| } | |
| export function getBatchSize(): number { | |
| const stored = localStorage.getItem(BATCH_SIZE_STORAGE_KEY); | |
| if (!stored) { | |
| return DEFAULT_BATCH_SIZE; | |
| } | |
| const parsed = parseInt(stored, 10); | |
| if (isNaN(parsed) || parsed < 0) { | |
| return DEFAULT_BATCH_SIZE; | |
| } | |
| if (parsed >= 999999) { | |
| return 0; | |
| } | |
| return parsed; | |
| } | |
| export function resetBatchSize(): void { | |
| localStorage.removeItem(BATCH_SIZE_STORAGE_KEY); | |
| } | |