Skip to content

Commit 43158f9

Browse files
authored
Merge pull request #910 from andyxr/automatic1111-webui
Parseq section has a new home; reset buttons on zoom and tr_z
2 parents 040da3d + 6e18cb5 commit 43158f9

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

scripts/deforum_helpers/ui_elements.py

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Contact the authors: https://deforum.github.io/
1616

1717
import gradio as gr
18-
from modules.ui_components import FormRow, FormColumn
18+
from modules.ui_components import FormRow, FormColumn, ToolButton
1919
from .defaults import get_gradio_html, DeforumAnimPrompts
2020
from .video_audio_utilities import direct_stitch_vid_from_frames
2121
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):
7878
return {k: v for k, v in {**locals(), **vars()}.items()}
7979

8080
def get_tab_keyframes(d, da, dloopArgs):
81+
components = {}
8182
with gr.TabItem('Keyframes'): # TODO make a some sort of the original dictionary parsing
8283
with FormRow():
8384
with FormColumn(scale=2):
@@ -154,11 +155,25 @@ def get_tab_keyframes(d, da, dloopArgs):
154155
with FormRow():
155156
checkpoint_schedule = create_gr_elem(da.checkpoint_schedule)
156157
# MOTION INNER TAB
158+
refresh_symbol = '\U0001f504' # 🔄
157159
with gr.Tabs(elem_id='motion_noise_etc'):
158160
with gr.TabItem('Motion') as motion_tab:
159161
with FormColumn() as only_2d_motion_column:
160-
with FormRow():
162+
with FormRow(variant="compact"):
161163
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+
)
162177
with FormRow():
163178
angle = create_gr_elem(da.angle)
164179
with FormRow():
@@ -173,6 +188,19 @@ def get_tab_keyframes(d, da, dloopArgs):
173188
with FormColumn(visible=False) as only_3d_motion_column:
174189
with FormRow():
175190
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+
)
176204
with FormRow():
177205
rotation_3d_x = create_gr_elem(da.rotation_3d_x)
178206
with FormRow():
@@ -190,6 +218,7 @@ def get_tab_keyframes(d, da, dloopArgs):
190218
perspective_flip_gamma = create_gr_elem(da.perspective_flip_gamma)
191219
with FormRow(visible=False) as per_f_f_row:
192220
perspective_flip_fv = create_gr_elem(da.perspective_flip_fv)
221+
193222
# NOISE INNER TAB
194223
with gr.TabItem('Noise'):
195224
with FormColumn() as noise_tab_column:
@@ -347,13 +376,12 @@ def get_tab_init(d, da, dp):
347376
mask_contrast_adjust = create_gr_elem(d.mask_contrast_adjust)
348377
with FormColumn(min_width=250):
349378
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'):
353381
with FormRow():
354382
parseq_manifest = create_gr_elem(dp.parseq_manifest)
355383
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)
357385
with FormRow():
358386
parseq_use_deltas = create_gr_elem(dp.parseq_use_deltas)
359387
return {k: v for k, v in {**locals(), **vars()}.items()}

0 commit comments

Comments
 (0)