From 259768f27fc4da61000610bc81a16f0152b36550 Mon Sep 17 00:00:00 2001 From: AUTOMATIC1111 <16777216c@gmail.com> Date: Sat, 9 Sep 2023 08:38:42 +0300 Subject: [PATCH] fix the bug in script-info API --- modules/scripts.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/scripts.py b/modules/scripts.py index e8518ad0f..f1f17a5f7 100644 --- a/modules/scripts.py +++ b/modules/scripts.py @@ -491,11 +491,15 @@ class ScriptRunner: arg_info = api_models.ScriptArg(label=control.label or "") - for field in ("value", "minimum", "maximum", "step", "choices"): + for field in ("value", "minimum", "maximum", "step"): v = getattr(control, field, None) if v is not None: setattr(arg_info, field, v) + choices = getattr(control, 'choices', None) # as of gradio 3.41, some items in choices are strings, and some are tuples where the first elem is the string + if choices is not None: + setattr(arg_info, 'choices', [x[0] if isinstance(x, tuple) else x for x in choices]) + api_args.append(arg_info) script.api_info = api_models.ScriptInfo(