aboutsummaryrefslogtreecommitdiff
path: root/modules/ui_loadsave.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-08-10 17:04:38 +0300
committerAUTOMATIC1111 <16777216c@gmail.com>2023-08-10 17:04:38 +0300
commit70a01cd4440d708bf25cc50393c0430935a8ebc2 (patch)
treedaad07800a3dadfd3caeac1383c1c65ecfcb6284 /modules/ui_loadsave.py
parent1aefb5025929818b2a96cbb6148fcc2db7b947ec (diff)
parent070b034cd5b49eb5056a18b43f88aa223fec9e0b (diff)
Merge branch 'dev' into refiner
Diffstat (limited to 'modules/ui_loadsave.py')
-rw-r--r--modules/ui_loadsave.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/ui_loadsave.py b/modules/ui_loadsave.py
index 0052a5cc..ef6b0154 100644
--- a/modules/ui_loadsave.py
+++ b/modules/ui_loadsave.py
@@ -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,11 @@ 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)
+ elif isinstance(x, gr.Number) and field == 'value':
+ saved_value = float(saved_value)
+
setattr(obj, field, saved_value)
if init_field is not None:
init_field(saved_value)