diff --git a/blends/inf-zoom.png b/blends/inf-zoom.png new file mode 100644 index 0000000..482a63e Binary files /dev/null and b/blends/inf-zoom.png differ diff --git a/iz_helpers/helpers.py b/iz_helpers/helpers.py index 33a405d..5427cac 100644 --- a/iz_helpers/helpers.py +++ b/iz_helpers/helpers.py @@ -160,4 +160,29 @@ def find_ffmpeg_binary(): files.sort(key=lambda x: os.path.getmtime(x), reverse=True) return files[0] if files else 'ffmpeg' except: - return 'ffmpeg' \ No newline at end of file + return 'ffmpeg' + + +def renumberDataframe(data): + # Store the first sublist as index0 + index0 = data[0] + + # Skip the first sublist (index 0) + data = data[1:] + + try: + # Sort the data based on the first column + data.sort(key=lambda x: int(x[0])) + + # Renumber the index values sequentially + for i in range(len(data)): + data[i][0] = i + 1 + + except Exception as e: + print(f"An error occurred: {e}") + return [index0] + data + + # Prepend index0 to the renumbered data + data.insert(0, index0) + + return data \ No newline at end of file diff --git a/iz_helpers/ui.py b/iz_helpers/ui.py index 45d1456..751a7a4 100644 --- a/iz_helpers/ui.py +++ b/iz_helpers/ui.py @@ -18,7 +18,7 @@ from .static_variables import ( default_sampler, default_gradient_size, ) -from .helpers import validatePromptJson_throws, putPrompts, clearPrompts +from .helpers import validatePromptJson_throws, putPrompts, clearPrompts, renumberDataframe from .prompt_util import readJsonPrompt from .static_variables import promptTableHeaders @@ -319,6 +319,17 @@ Our best experience and trade-off is the R-ERSGAn4x upscaler. main_seed ], ) + renumberPrompts_button = gr.Button( + value= "Renumber Prompts", + variant="secondary", + elem_classes="sm infzoom_tab_butt", + elem_id="infzoom_rnP_butt", + ) + renumberPrompts_button.click( + fn=renumberDataframe, + inputs=[main_prompts], + outputs=[main_prompts] + ) with gr.Column(scale=1, variant="compact"): output_video = gr.Video(label="Output").style(width=512, height=512)