mypiper commited on
Commit
595469c
·
verified ·
1 Parent(s): 1763953

Create fal.yaml

Browse files
Files changed (1) hide show
  1. fal.yaml +204 -0
fal.yaml ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _id: fal
2
+ title: Fal AI
3
+ description: Cloud platform for serving media-generating AI models
4
+ version: 1
5
+ readme: |-
6
+ - added **Deblur**
7
+ - added **generate short clips SVD v1.1**
8
+ author: Anton Breslavskii | https://github.com/breslavsky
9
+ url: https://huggingface.co/PiperMy/Node-Packages/resolve/main/fal.yaml
10
+ nodes:
11
+ deblur_fal:
12
+ _id: deblur_fal
13
+ arrange:
14
+ x: 180
15
+ y: 120
16
+ category:
17
+ id: image_processing
18
+ title: en=Work with images;ru=Работа с изображениями
19
+ environment:
20
+ FAL_KEY:
21
+ title: Fal API KEY
22
+ type: string
23
+ scope: global
24
+ inputs:
25
+ image:
26
+ order: 1
27
+ title: en=Image;ru=Изображение
28
+ type: image
29
+ required: true
30
+ outputs:
31
+ image:
32
+ title: en=Image;ru=Изображение
33
+ type: image
34
+ package: fal
35
+ script: |-
36
+ export async function run({ inputs, state }) {
37
+
38
+ const { image } = inputs;
39
+ const { FatalError, RepeatNode, NextNode } = DEFINITIONS;
40
+
41
+ const FAL_KEY = env?.variables?.get('FAL_KEY');
42
+ if (!FAL_KEY) {
43
+ throw new FatalError('Please, set your API key for Fal AI');
44
+ }
45
+
46
+ const { fal } = require('@fal-ai/client');
47
+ fal.config({ credentials: FAL_KEY });
48
+
49
+ if (!state) {
50
+ const { request_id: task } = await fal.queue.submit("fal-ai/nafnet/deblur", {
51
+ input: {
52
+ image_url: image
53
+ }
54
+ });
55
+ return RepeatNode.from({ state: { task }, delay: 3000 });
56
+ } else {
57
+ const { task } = state;
58
+ const { status, queue_position: position } = await fal.queue.status("fal-ai/nafnet/deblur", {
59
+ requestId: task,
60
+ logs: true,
61
+ });
62
+ console.log('Status & position', status, position);
63
+ switch (status) {
64
+ case 'COMPLETED':
65
+ // get results
66
+ break;
67
+ case 'IN_PROGRESS':
68
+ case 'IN_QUEUE':
69
+ default:
70
+ return RepeatNode.from({ delay: 5000, state });
71
+ }
72
+
73
+ const { data } = await fal.queue.result("fal-ai/nafnet/deblur", { requestId: task });
74
+ const { image: { url } } = data;
75
+ return NextNode.from({ outputs: { image: url } })
76
+ }
77
+
78
+ }
79
+ source: catalog
80
+ title: en=Deblur;ru=Убрать размытие
81
+ version: 1
82
+ fast_svd_lcm_fal:
83
+ _id: fast_svd_lcm_fal
84
+ arrange:
85
+ x: 530
86
+ y: 120
87
+ category:
88
+ id: video_generation
89
+ title: en=Generate videos;ru=Генерация видео
90
+ environment:
91
+ FAL_KEY:
92
+ title: Fal API KEY
93
+ type: string
94
+ scope: global
95
+ groups:
96
+ inputs:
97
+ extra:
98
+ order: 1
99
+ title: Additional settings
100
+ inputs:
101
+ image:
102
+ order: 1
103
+ title: en=Image;ru=Изображение
104
+ type: image
105
+ required: true
106
+ steps:
107
+ order: 3
108
+ title: Steps
109
+ 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.
110
+ group: extra
111
+ type: integer
112
+ min: 1
113
+ max: 20
114
+ step: 1
115
+ default: 4
116
+ motionBucketId:
117
+ order: 1
118
+ title: Motion Bucket Id
119
+ description: The motion bucket id determines the motion of the generated video. The higher the number, the more motion there will be.
120
+ group: extra
121
+ type: integer
122
+ min: 1
123
+ max: 255
124
+ step: 1
125
+ default: 127
126
+ condAug:
127
+ order: 2
128
+ title: Cond Aug
129
+ 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.
130
+ group: extra
131
+ type: float
132
+ min: 0.02
133
+ max: 10
134
+ step: 0.01
135
+ default: 0.02
136
+ fps:
137
+ order: 4
138
+ title: FPS
139
+ description: The FPS of the generated video. The higher the number, the faster the video will play. Total video length is 25 frames
140
+ group: extra
141
+ type: integer
142
+ min: 1
143
+ max: 25
144
+ step: 1
145
+ default: 10
146
+ outputs:
147
+ video:
148
+ title: en=Video;ru=Видео
149
+ type: video
150
+ package: fal
151
+ script: |-
152
+ export async function run({ inputs, state }) {
153
+
154
+ const { image, motionBucketId, condAug, steps, fps } = inputs;
155
+ const { FatalError, RepeatNode, NextNode } = DEFINITIONS;
156
+
157
+ const FAL_KEY = env?.variables?.get('FAL_KEY');
158
+ if (!FAL_KEY) {
159
+ throw new FatalError('Please, set your API key for Fal AI');
160
+ }
161
+
162
+ const { fal } = require('@fal-ai/client');
163
+ fal.config({ credentials: FAL_KEY });
164
+
165
+ if (!state) {
166
+ const payload = {
167
+ input: {
168
+ image_url: image,
169
+ motion_bucket_id: motionBucketId || 127,
170
+ cond_aug: condAug || 0.02,
171
+ steps: steps || 4,
172
+ fps: fps || 10
173
+
174
+ }
175
+ };
176
+ const { request_id: task } = await fal.queue.submit("fal-ai/fast-svd-lcm", payload);
177
+ return RepeatNode.from({ state: { task, payload }, delay: 3000 });
178
+ } else {
179
+ const { task } = state;
180
+ const { status, queue_position: position } = await fal.queue.status("fal-ai/fast-svd-lcm", {
181
+ requestId: task,
182
+ logs: true,
183
+ });
184
+ console.log('Status & position', status, position);
185
+ switch (status) {
186
+ case 'COMPLETED':
187
+ // get results
188
+ break;
189
+ case 'IN_PROGRESS':
190
+ case 'IN_QUEUE':
191
+ default:
192
+ return RepeatNode.from({ delay: 5000, state });
193
+ }
194
+
195
+ const { data } = await fal.queue.result("fal-ai/fast-svd-lcm", { requestId: task });
196
+ console.log(JSON.stringify(data));
197
+ const { video: { url } } = data;
198
+ return NextNode.from({ outputs: { video: url } })
199
+ }
200
+
201
+ }
202
+ source: catalog
203
+ title: en=Generate short video clip;ru=Создать короткий видео-клип
204
+ version: 1