toshiaki1729 / dataset-tag-editor-standalone

WebUI to edit dataset captions for txt2img models
MIT License
129 stars 13 forks source link

[BUG] After reloding, `on_filter_update_callbacks` was not cleared #16

Closed WSH032 closed 4 months ago

WSH032 commented 1 year ago

@toshiaki1729

https://github.com/toshiaki1729/dataset-tag-editor-standalone/blob/3ddf4c4a92a28fec9a5388792d73ba85db3cc437/scripts/interface.py#L160

If you set

- analytics_enabled=False
+ analytics_enabled=True

And reload UI, you will notice that.


This is because the following two lists were not cleared after restarting

ui.filter_by_tags.tag_filter_ui.on_filter_update_callbacks
ui.filter_by_tags.tag_filter_ui_neg.on_filter_update_callbacks

So it will add callback function for the previous Gradio.Blocks components. That will be found by Gradio analytics, and raise error.

self.tag_filter_ui.set_callbacks()
self.tag_filter_ui_neg.set_callbacks()
toshiaki1729 commented 1 year ago

I think this script doesn't have reloading feature. I wonder how you could do?

WSH032 commented 1 year ago

Set analytics_enabled=True @@R@HRS9KZ{_}DBB(24_N0G

Then Reload UI 7CVKR~XA@)$ 0S9BZLCB)KO

You will notice that 1$FTQTI6BXU2ARU94SPNI_P


By the way, Gradio has already fixed it https://github.com/gradio-app/gradio/issues/4642

WSH032 commented 1 year ago

I use your repository while creating WSH032/sd-webui-fast-dataset-maker, and at that time I discovered this issue

I fix it by this way https://github.com/WSH032/dataset-tag-editor-standalone/blob/ec8617609c38888b24b04593751e2c2e056242d3/scripts/tab_main.py#L517C1-L520C76

And, your repository is really awesome.

toshiaki1729 commented 1 year ago

I think this script doesn't have reloading feature.

https://github.com/toshiaki1729/dataset-tag-editor-standalone/blob/6d827f1a9827821604f473429ffdb80851d2722e/scripts/tab_settings.py#L49

Confirmed: I don't know anything about my script

Anyway, thank you so much for utilizing this repository.

By the way, Gradio has already fixed it https://github.com/gradio-app/gradio/issues/4642

I understand that it will be fixed, but I will look into it in more detail just to be sure. Thank you.

WSH032 commented 1 year ago

Great!


I still hava another issue, have you noticed that if don't enable thumbnails, loading will become incredibly slow

And once too many images are loaded, the tag filter will no longer work

Should I open another issue?

toshiaki1729 commented 4 months ago

I've updated gradio to 4.28.3 in >= ver0.0.6. And the issue when loading many images may be solved. I'm grad if you can check it.