diff --git a/BatchFuncs.py b/BatchFuncs.py index f847c92..d455425 100644 --- a/BatchFuncs.py +++ b/BatchFuncs.py @@ -149,17 +149,17 @@ def interpolate_prompt_series(animation_prompts, max_frames, start_frame, pre_te index_offset = 0 # Evaluate the current and next prompt's expressions - for i in range(start_frame, max_frames-1): - cur_prompt_series[i] = prepare_batch_prompt(cur_prompt_series[i], max_frames, i, prompt_weight_1, - prompt_weight_2, prompt_weight_3, prompt_weight_4) - nxt_prompt_series[i] = prepare_batch_prompt(nxt_prompt_series[i], max_frames, i, prompt_weight_1, - prompt_weight_2, prompt_weight_3, prompt_weight_4) + for i in range(start_frame, len(cur_prompt_series)): + cur_prompt_series[i] = prepare_batch_prompt(cur_prompt_series[i], max_frames, i, float(prompt_weight_1[0]), + prompt_weight_2[i], prompt_weight_3[i], prompt_weight_4[i]) + nxt_prompt_series[i] = prepare_batch_prompt(nxt_prompt_series[i], max_frames, i, prompt_weight_1[i], + prompt_weight_2[i], prompt_weight_3[i], prompt_weight_4[i]) if Is_print == True: # Show the to/from prompts with evaluated expressions for transparency. - print("\n", "Max Frames: ", max_frames, "\n", "frame index: ", (start_frame+i), "\n", "Current Prompt: ", + print("\n", "Max Frames: ", max_frames, "\n", "frame index: ", (start_frame + i), "\n", "Current Prompt: ", cur_prompt_series[i], "\n", "Next Prompt: ", nxt_prompt_series[i], "\n", "Strength : ", weight_series[i], "\n") - index_offset = index_offset+1 + index_offset = index_offset + 1 diff --git a/ValueFuncs.py b/ValueFuncs.py index 67e2905..026cdab 100644 --- a/ValueFuncs.py +++ b/ValueFuncs.py @@ -6,8 +6,12 @@ import re import json from .ScheduleFuncs import check_is_number + + def sanitize_value(value): - return value.replace("'", "").replace('"', "").replace('(', "").replace(')', "") + # Remove single quotes, double quotes, and parentheses + value = value.replace("'", "").replace('"', "").replace('(', "").replace(')', "") + return value def get_inbetweens(key_frames, max_frames, integer=False, interp_method='Linear', is_single_string=False): @@ -65,9 +69,9 @@ def batch_get_inbetweens(key_frames, max_frames, integer=False, interp_method='L value_is_number = False for i in range(0, max_frames): if i in key_frames: - value = key_frames[i] + value = str(key_frames[i]) # Convert to string to ensure it's treated as an expression value_is_number = check_is_number(sanitize_value(value)) - if value_is_number: # if it's only a number, leave the rest for the default interpolation + if value_is_number: key_frame_series[i] = sanitize_value(value) if not value_is_number: t = i