fix --use-textbox-seed

This commit is contained in:
AUTOMATIC1111
2023-08-10 15:58:53 +03:00
parent 4d93f48f09
commit 1b3093fe3a
3 changed files with 19 additions and 4 deletions

View File

@@ -8,7 +8,7 @@ from modules.ui_components import ToolButton
class UiLoadsave:
"""allows saving and restorig default values for gradio components"""
"""allows saving and restoring default values for gradio components"""
def __init__(self, filename):
self.filename = filename
@@ -48,6 +48,9 @@ class UiLoadsave:
elif condition and not condition(saved_value):
pass
else:
if isinstance(x, gr.Textbox) and field == 'value': # due to an undersirable behavior of gr.Textbox, if you give it an int value instead of str, everything dies
saved_value = str(saved_value)
setattr(obj, field, saved_value)
if init_field is not None:
init_field(saved_value)