| _id: fal | |
| author: Anton Breslavskii | https://github.com/breslavsky | |
| description: Cloud platform for serving media-generating AI models | |
| readme: |- | |
| - added **Deblur** | |
| - added **generate short clips SVD v1.1** | |
| title: Fal AI | |
| url: https://huggingface.co/PiperMy/Node-Packages/resolve/main/fal.yaml | |
| version: 2 | |
| nodes: | |
| deblur_fal: | |
| _id: deblur_fal | |
| arrange: | |
| x: 180 | |
| y: 120 | |
| category: | |
| _id: image_processing | |
| title: en=Work with images;ru=Работа с изображениями | |
| environment: | |
| FAL_KEY: | |
| title: Fal API KEY | |
| type: string | |
| scope: global | |
| inputs: | |
| image: | |
| order: 1 | |
| title: en=Image;ru=Изображение | |
| type: image | |
| required: true | |
| outputs: | |
| image: | |
| title: en=Image;ru=Изображение | |
| type: image | |
| package: fal | |
| script: |- | |
| export async function run({ inputs, state }) { | |
| const { image } = inputs; | |
| const { FatalError, RepeatNode, NextNode } = DEFINITIONS; | |
| const FAL_KEY = env?.variables?.get('FAL_KEY'); | |
| if (!FAL_KEY) { | |
| throw new FatalError('Please, set your API key for Fal AI'); | |
| } | |
| const { fal } = require('@fal-ai/client'); | |
| fal.config({ credentials: FAL_KEY }); | |
| if (!state) { | |
| const { request_id: task } = await fal.queue.submit("fal-ai/nafnet/deblur", { | |
| input: { | |
| image_url: image | |
| } | |
| }); | |
| return RepeatNode.from({ state: { task }, delay: 3000 }); | |
| } else { | |
| const { task } = state; | |
| const { status, queue_position: position } = await fal.queue.status("fal-ai/nafnet/deblur", { | |
| requestId: task, | |
| logs: true, | |
| }); | |
| console.log('Status & position', status, position); | |
| switch (status) { | |
| case 'COMPLETED': | |
| // get results | |
| break; | |
| case 'IN_PROGRESS': | |
| case 'IN_QUEUE': | |
| default: | |
| return RepeatNode.from({ delay: 5000, state }); | |
| } | |
| const { data } = await fal.queue.result("fal-ai/nafnet/deblur", { requestId: task }); | |
| const { image: { url } } = data; | |
| return NextNode.from({ outputs: { image: url } }) | |
| } | |
| } | |
| source: catalog | |
| title: en=Deblur;ru=Убрать размытие | |
| version: 1 | |
| fast_svd_lcm_fal: | |
| _id: fast_svd_lcm_fal | |
| arrange: | |
| x: 510 | |
| y: 60 | |
| category: | |
| _id: video_generation | |
| title: en=Generate videos;ru=Генерация видео | |
| environment: | |
| FAL_KEY: | |
| title: Fal API KEY | |
| type: string | |
| scope: global | |
| groups: | |
| inputs: | |
| extra: | |
| order: 1 | |
| title: Additional settings | |
| inputs: | |
| image: | |
| order: 1 | |
| title: en=Image;ru=Изображение | |
| type: image | |
| required: true | |
| steps: | |
| order: 3 | |
| title: Steps | |
| description: The conditoning augmentation determines the amount of noise that will be added to the conditioning frame. The higher the number, the more noise there will be, and the less the video will look like the initial image. Increase it for more motion. | |
| group: extra | |
| type: integer | |
| min: 1 | |
| max: 20 | |
| step: 1 | |
| default: 4 | |
| motionBucketId: | |
| order: 1 | |
| title: Motion Bucket Id | |
| description: The motion bucket id determines the motion of the generated video. The higher the number, the more motion there will be. | |
| group: extra | |
| type: integer | |
| min: 1 | |
| max: 255 | |
| step: 1 | |
| default: 127 | |
| condAug: | |
| order: 2 | |
| title: Cond Aug | |
| description: The conditoning augmentation determines the amount of noise that will be added to the conditioning frame. The higher the number, the more noise there will be, and the less the video will look like the initial image. Increase it for more motion. | |
| group: extra | |
| type: float | |
| min: 0.02 | |
| max: 10 | |
| step: 0.01 | |
| default: 0.02 | |
| fps: | |
| order: 4 | |
| title: FPS | |
| description: The FPS of the generated video. The higher the number, the faster the video will play. Total video length is 25 frames | |
| group: extra | |
| type: integer | |
| min: 1 | |
| max: 25 | |
| step: 1 | |
| default: 10 | |
| outputs: | |
| video: | |
| title: en=Video;ru=Видео | |
| type: video | |
| package: fal | |
| script: |- | |
| export async function run({ inputs, state }) { | |
| const { image, motionBucketId, condAug, steps, fps } = inputs; | |
| const { FatalError, RepeatNode, NextNode } = DEFINITIONS; | |
| const FAL_KEY = env?.variables?.get('FAL_KEY'); | |
| if (!FAL_KEY) { | |
| throw new FatalError('Please, set your API key for Fal AI'); | |
| } | |
| const { fal } = require('@fal-ai/client'); | |
| fal.config({ credentials: FAL_KEY }); | |
| if (!state) { | |
| const payload = { | |
| input: { | |
| image_url: image, | |
| motion_bucket_id: motionBucketId || 127, | |
| cond_aug: condAug || 0.02, | |
| steps: steps || 4, | |
| fps: fps || 10 | |
| } | |
| }; | |
| const { request_id: task } = await fal.queue.submit("fal-ai/fast-svd-lcm", payload); | |
| return RepeatNode.from({ state: { task, payload }, delay: 3000 }); | |
| } else { | |
| const { task } = state; | |
| const { status, queue_position: position } = await fal.queue.status("fal-ai/fast-svd-lcm", { | |
| requestId: task, | |
| logs: true, | |
| }); | |
| console.log('Status & position', status, position); | |
| switch (status) { | |
| case 'COMPLETED': | |
| // get results | |
| break; | |
| case 'IN_PROGRESS': | |
| case 'IN_QUEUE': | |
| default: | |
| return RepeatNode.from({ delay: 5000, state }); | |
| } | |
| const { data } = await fal.queue.result("fal-ai/fast-svd-lcm", { requestId: task }); | |
| console.log(JSON.stringify(data)); | |
| const { video: { url } } = data; | |
| return NextNode.from({ outputs: { video: url } }) | |
| } | |
| } | |
| source: catalog | |
| title: en=Generate short video clip;ru=Создать короткий видео-клип | |
| version: 1 | |