fixed control character error in batch schedule

This commit is contained in:
FizzleDorf
2024-01-26 21:21:52 +09:00
parent 99d50c36eb
commit d32d37cf95
2 changed files with 14 additions and 10 deletions
+7 -7
View File
@@ -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
+7 -3
View File
@@ -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