ArtVentureX / sd-webui-agent-scheduler

627 stars 65 forks source link

agent scheduler is not compatible with gradio 3.45 and higher #147

Open vladmandic opened 12 months ago

vladmandic commented 12 months ago

for example, using gradio==3.45.2.:

executing callback: /home/vlado/dev/sdnext/extensions-builtin/sd-webui-agent-scheduler/scripts/task_scheduler.py app_started_callback: KeyError

│ /home/vlado/dev/sdnext/modules/script_callbacks.py:133 in app_started_callback                                                                                                                       │
│                                                                                                                                                                                                      │
│   132 │   │   │   t0 = time.time()                                                                                                                                                                   │
│ ❱ 133 │   │   │   c.callback(demo, app)                                                                                                                                                              │
│   134 │   │   │   timer(t0, c.script, 'app_started')                                                                                                                                                 │
│                                                                                                                                                                                                      │
│ /home/vlado/dev/sdnext/extensions-builtin/sd-webui-agent-scheduler/scripts/task_scheduler.py:65 in <lambda>                                                                                          │
│                                                                                                                                                                                                      │
│    64 │   │   super().__init__()                                                                                                                                                                     │
│ ❱  65 │   │   script_callbacks.on_app_started(lambda block, _: self.on_app_started(block))                                                                                                           │
│    66 │   │   self.checkpoint_override = checkpoint_current                                                                                                                                          │
│                                                                                                                                                                                                      │
│ /home/vlado/dev/sdnext/extensions-builtin/sd-webui-agent-scheduler/scripts/task_scheduler.py:105 in on_app_started                                                                                   │
│                                                                                                                                                                                                      │
│   104 │   │   if self.generate_button is not None:                                                                                                                                                   │
│ ❱ 105 │   │   │   self.bind_enqueue_button(block)                                                                                                                                                    │
│   106                                                                                                                                                                                                │
│                                                                                                                                                                                                      │
│ /home/vlado/dev/sdnext/extensions-builtin/sd-webui-agent-scheduler/scripts/task_scheduler.py:131 in bind_enqueue_button                                                                              │
│                                                                                                                                                                                                      │
│   130 │   │   is_img2img = self.is_img2img                                                                                                                                                           │
│ ❱ 131 │   │   dependencies: List[dict] = [                                                                                                                                                           │
│   132 │   │   │   x for x in root.dependencies if x["trigger"] == "click" and generate._id in                                                                                                        │
│                                                                                                                                                                                                      │
│ /home/vlado/dev/sdnext/extensions-builtin/sd-webui-agent-scheduler/scripts/task_scheduler.py:132 in <listcomp>                                                                                       │
│                                                                                                                                                                                                      │
│   131 │   │   dependencies: List[dict] = [                                                                                                                                                           │
│ ❱ 132 │   │   │   x for x in root.dependencies if x["trigger"] == "click" and generate._id in                                                                                                        │
│   133 │   │   ]

KeyError: 'trigger'

this is likely caused by change in gradio in this pr: 5639

artventuredev commented 12 months ago

I've set gradio to version 3.45.2 in the latest master and made some modifications to ensure the code functions. However, I was unable to launch the webui, and encountered errors in the browser console. Despite disabling the extension, the errors persisted, indicating they're likely not related to the extension. Is there anything else I need to do to make the code compatible with the new gradio version? Anw, you can try the modified code in branch fix/new_gradio.

image
vladmandic commented 12 months ago

i was just debugging that. it seems like a bug in gradio introduced via https://github.com/gradio-app/gradio/pull/5384 and breaks gradio dropdowns with multiselect enabled.

basically, gradio svelte function that handles multiselect has its params offset by one, so label becomes type, value becomes choices and choices become null. i'll follow-up with gradio team.

for reference: https://github.com/gradio-app/gradio/issues/5850