@@ -570,40 +570,44 @@ def create_script_ui(self, script):
570
570
if controls is None :
571
571
return
572
572
573
- script .name = wrap_call (script .title , script .filename , "title" , default = script .filename ).lower ()
574
- api_args = []
573
+ try :
574
+ script .name = wrap_call (script .title , script .filename , "title" , default = script .filename ).lower ()
575
+ api_args = []
575
576
576
- for control in controls :
577
- control .custom_script_source = os .path .basename (script .filename )
577
+ for control in controls :
578
+ control .custom_script_source = os .path .basename (script .filename )
578
579
579
- arg_info = api_models .ScriptArg (label = control .label or "" )
580
+ arg_info = api_models .ScriptArg (label = control .label or "" )
580
581
581
- for field in ("value" , "minimum" , "maximum" , "step" ):
582
- v = getattr (control , field , None )
583
- if v is not None :
584
- setattr (arg_info , field , v )
582
+ for field in ("value" , "minimum" , "maximum" , "step" ):
583
+ v = getattr (control , field , None )
584
+ if v is not None :
585
+ setattr (arg_info , field , v )
585
586
586
- 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
587
- if choices is not None :
588
- arg_info .choices = [x [0 ] if isinstance (x , tuple ) else x for x in choices ]
587
+ 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
588
+ if choices is not None :
589
+ arg_info .choices = [x [0 ] if isinstance (x , tuple ) else x for x in choices ]
589
590
590
- api_args .append (arg_info )
591
+ api_args .append (arg_info )
591
592
592
- script .api_info = api_models .ScriptInfo (
593
- name = script .name ,
594
- is_img2img = script .is_img2img ,
595
- is_alwayson = script .alwayson ,
596
- args = api_args ,
597
- )
593
+ script .api_info = api_models .ScriptInfo (
594
+ name = script .name ,
595
+ is_img2img = script .is_img2img ,
596
+ is_alwayson = script .alwayson ,
597
+ args = api_args ,
598
+ )
598
599
599
- if script .infotext_fields is not None :
600
- self .infotext_fields += script .infotext_fields
600
+ if script .infotext_fields is not None :
601
+ self .infotext_fields += script .infotext_fields
601
602
602
- if script .paste_field_names is not None :
603
- self .paste_field_names += script .paste_field_names
603
+ if script .paste_field_names is not None :
604
+ self .paste_field_names += script .paste_field_names
604
605
605
- self .inputs += controls
606
- script .args_to = len (self .inputs )
606
+ self .inputs += controls
607
+ script .args_to = len (self .inputs )
608
+
609
+ except Exception :
610
+ errors .report (f"Error creating UI for { script .name } : " , exc_info = True )
607
611
608
612
def setup_ui_for_section (self , section , scriptlist = None ):
609
613
if scriptlist is None :
0 commit comments