Преглед изворни кода

Check if app should display extensions ui

Maya пре 2 година
родитељ
комит
acdbd6b708
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4 1
      modules/extensions.py

+ 4 - 1
modules/extensions.py

@@ -46,15 +46,18 @@ def create_extensions_block():
                 if _id in shared.settings:
                     extension.params[param] = shared.settings[_id]
 
+    should_display_ui = False
     # Running setup function
     if not setup_called:
         for extension, name in iterator():
             if hasattr(extension, "setup"):
                 extension.setup()
+            if hasattr(extension, "ui"):
+                should_display_ui = True
         setup_called = True
 
     # Creating the extension ui elements
-    if len(state) > 0:
+    if should_display_ui:
         with gr.Box(elem_id="extensions"):
             gr.Markdown("Extensions")
             for extension, name in iterator():