ljleb / sd-webui-neutral-prompt

Collision-free AND keywords for a1111 webui!
MIT License
187 stars 13 forks source link

Extension does not properly initialize on SD.Next #67

Open redrum-llik opened 7 months ago

redrum-llik commented 7 months ago

Hello! Was really impressed by the description of the extension and wanted to give it a try on my local SD.Next installation. After installing from URL and restarting the whole process, I saw the following in the console:

18:34:36-822022 ERROR    Calling script: extensions\sd-webui-neutral-prompt\scripts\neutral_prompt.py/ui:
                         DuplicateBlockError
┌───────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────┐
│ E:\Automatic\modules\scripts.py:293 in wrap_call                                                                    │
│                                                                                                                     │
│   292 │   try:                                                                                                      │
│ > 293 │   │   res = func(*args, **kwargs)                                                                           │
│   294 │   │   return res                                                                                            │
│                                                                                                                     │
│ E:\Automatic\extensions\sd-webui-neutral-prompt\scripts\neutral_prompt.py:31 in ui                                  │
│                                                                                                                     │
│   30 │   │                                                                                                          │
│ > 31 │   │   self.accordion_interface.arrange_components(is_img2img)                                                │
│   32 │   │   self.accordion_interface.connect_events(is_img2img)                                                    │
│                                                                                                                     │
│ E:\Automatic\extensions\sd-webui-neutral-prompt\lib_neutral_prompt\ui.py:43 in arrange_components                   │
│                                                                                                                     │
│    42 │   │   with gr.Accordion(label='Neutral Prompt', open=False):                                                │
│ >  43 │   │   │   self.cfg_rescale.render()                                                                         │
│    44 │   │   │   with gr.Accordion(label='Prompt formatter', open=False):                                          │
│                                                                                                                     │
│ E:\Automatic\venv\lib\site-packages\gradio\blocks.py:126 in render                                                  │
│                                                                                                                     │
│    125 │   │   if Context.root_block is not None and self._id in Context.root_block.blocks:                         │
│ >  126 │   │   │   raise DuplicateBlockError(                                                                       │
│    127 │   │   │   │   f"A block with id: {self._id} has already been rendered in the current Blocks."              │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
DuplicateBlockError: A block with id: 1 has already been rendered in the current Blocks.

Some screenshots of the UI:

image

image

(On the above image, "Neutral Prompt" tab is expanded but it has no content.)

On an attempt to generate something I get the following exception:

Traceback (most recent call last):
  File "E:\Automatic\venv\lib\site-packages\gradio\queueing.py", line 388, in call_prediction
    output = await route_utils.call_process_api(
  File "E:\Automatic\venv\lib\site-packages\gradio\route_utils.py", line 219, in call_process_api
    output = await app.get_blocks().process_api(
  File "E:\Automatic\venv\lib\site-packages\gradio\blocks.py", line 1435, in process_api
    inputs = self.preprocess_data(fn_index, inputs, state)
  File "E:\Automatic\venv\lib\site-packages\gradio\blocks.py", line 1228, in preprocess_data
    self.validate_inputs(fn_index, inputs)
  File "E:\Automatic\venv\lib\site-packages\gradio\blocks.py", line 1215, in validate_inputs
    raise ValueError(
ValueError: An event handler (fn) didn't receive enough input values (needed: 2, got: 1).
Check if the event handler calls a Javascript function, and make sure its return value is correct.
Wanted inputs:
    [state, dropdown]
Received inputs:
    [None]

I was not entirely sure if you aim to have this extension compatible with SD.Next since it is not explicitly stated on the README, but if you do, I am happy to assist with any details you may need from me.

ljleb commented 6 months ago

Thanks for the report, I am working on something else currently but I'll try to take a look this week. PRs are welcome if you want this fixed sooner.