Spaces:
Paused
Paused
Download src/utils/validators/getValidResolution.mts from jbilcke-hf/VideoChain-API: direct link, hf CLI and curl.
- Browser
- Download file 431 Bytes
-
https://huggingface.co/spaces/jbilcke-hf/VideoChain-API/resolve/cd4ee95e1e76fb32012ff8216dcaad5839176a8a/src/utils/validators/getValidResolution.mts
- Command line
-
hf download hf://spaces/jbilcke-hf/VideoChain-API@cd4ee95e1e76fb32012ff8216dcaad5839176a8a/src/utils/validators/getValidResolution.mts
-
curl -L -o getValidResolution.mts https://huggingface.co/spaces/jbilcke-hf/VideoChain-API/resolve/cd4ee95e1e76fb32012ff8216dcaad5839176a8a/src/utils/validators/getValidResolution.mts
431 Bytes
| import { getValidNumber } from "./getValidNumber.mts" | |
| export const getValidResolution = (something: any) => { | |
| const strValue = `${something || ''}` | |
| const chunks = strValue.split('x') | |
| if (chunks.length !== 2) { | |
| return `1280x720` | |
| } | |
| const [widthStr, heightStr] = chunks | |
| const width = getValidNumber(widthStr, 256, 1280, 1280) | |
| const height = getValidNumber(widthStr, 256, 720, 720) | |
| return `${width}x${height}` | |
| } |