15
15
# Contact the authors: https://deforum.github.io/
16
16
17
17
import gradio as gr
18
- from modules .ui_components import FormRow , FormColumn
18
+ from modules .ui_components import FormRow , FormColumn , ToolButton
19
19
from .defaults import get_gradio_html , DeforumAnimPrompts
20
20
from .video_audio_utilities import direct_stitch_vid_from_frames
21
21
from .gradio_funcs import upload_vid_to_interpolate , upload_pics_to_interpolate , ncnn_upload_vid_to_upscale , upload_vid_to_depth
@@ -78,6 +78,7 @@ def get_tab_run(d, da):
78
78
return {k : v for k , v in {** locals (), ** vars ()}.items ()}
79
79
80
80
def get_tab_keyframes (d , da , dloopArgs ):
81
+ components = {}
81
82
with gr .TabItem ('Keyframes' ): # TODO make a some sort of the original dictionary parsing
82
83
with FormRow ():
83
84
with FormColumn (scale = 2 ):
@@ -154,11 +155,25 @@ def get_tab_keyframes(d, da, dloopArgs):
154
155
with FormRow ():
155
156
checkpoint_schedule = create_gr_elem (da .checkpoint_schedule )
156
157
# MOTION INNER TAB
158
+ refresh_symbol = '\U0001f504 ' # 🔄
157
159
with gr .Tabs (elem_id = 'motion_noise_etc' ):
158
160
with gr .TabItem ('Motion' ) as motion_tab :
159
161
with FormColumn () as only_2d_motion_column :
160
- with FormRow ():
162
+ with FormRow (variant = "compact" ):
161
163
zoom = create_gr_elem (da .zoom )
164
+ reset_zoom_button = ToolButton (elem_id = 'reset_zoom_btn' , value = refresh_symbol , tooltip = "Reset zoom to static." )
165
+ components ['zoom' ] = zoom
166
+
167
+ def reset_zoom_field ():
168
+ return {
169
+ zoom : gr .update (value = '0:(1)' , visible = True )
170
+ }
171
+
172
+ reset_zoom_button .click (
173
+ fn = reset_zoom_field ,
174
+ inputs = [],
175
+ outputs = [zoom ]
176
+ )
162
177
with FormRow ():
163
178
angle = create_gr_elem (da .angle )
164
179
with FormRow ():
@@ -173,6 +188,19 @@ def get_tab_keyframes(d, da, dloopArgs):
173
188
with FormColumn (visible = False ) as only_3d_motion_column :
174
189
with FormRow ():
175
190
translation_z = create_gr_elem (da .translation_z )
191
+ reset_tr_z_button = ToolButton (elem_id = 'reset_tr_z_btn' , value = refresh_symbol , tooltip = "Reset translation Z to static." )
192
+ components ['tr_z' ] = translation_z
193
+
194
+ def reset_tr_z_field ():
195
+ return {
196
+ translation_z : gr .update (value = '0:(0)' , visible = True )
197
+ }
198
+
199
+ reset_tr_z_button .click (
200
+ fn = reset_tr_z_field ,
201
+ inputs = [],
202
+ outputs = [translation_z ]
203
+ )
176
204
with FormRow ():
177
205
rotation_3d_x = create_gr_elem (da .rotation_3d_x )
178
206
with FormRow ():
@@ -190,6 +218,7 @@ def get_tab_keyframes(d, da, dloopArgs):
190
218
perspective_flip_gamma = create_gr_elem (da .perspective_flip_gamma )
191
219
with FormRow (visible = False ) as per_f_f_row :
192
220
perspective_flip_fv = create_gr_elem (da .perspective_flip_fv )
221
+
193
222
# NOISE INNER TAB
194
223
with gr .TabItem ('Noise' ):
195
224
with FormColumn () as noise_tab_column :
@@ -347,13 +376,12 @@ def get_tab_init(d, da, dp):
347
376
mask_contrast_adjust = create_gr_elem (d .mask_contrast_adjust )
348
377
with FormColumn (min_width = 250 ):
349
378
mask_brightness_adjust = create_gr_elem (d .mask_brightness_adjust )
350
- # PARSEQ ACCORD
351
- with gr .Accordion ('Parseq' , open = False ):
352
- gr .HTML (value = get_gradio_html ('parseq' ))
379
+ # PARSEQ INNER-TAB
380
+ with gr .Tab ('Parseq' ):
353
381
with FormRow ():
354
382
parseq_manifest = create_gr_elem (dp .parseq_manifest )
355
383
with FormRow ():
356
- parseq_non_schedule_overrides = create_gr_elem (dp .parseq_non_schedule_overrides )
384
+ parseq_non_schedule_overrides = create_gr_elem (dp .parseq_non_schedule_overrides )
357
385
with FormRow ():
358
386
parseq_use_deltas = create_gr_elem (dp .parseq_use_deltas )
359
387
return {k : v for k , v in {** locals (), ** vars ()}.items ()}
0 commit comments