toshiaki1729/dataset-tag-editor-standalone

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

Closed this issue ยท 6 comments

WSH032 commented

@toshiaki1729

with gr.Blocks(analytics_enabled=False, title="Dataset Tag Editor") as gui:

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()

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

WSH032 commented

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 gradio-app/gradio#4642

WSH032 commented

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.

I think this script doesn't have reloading feature.

btn_reload = gr.Button("Reload UI", variant="primary", elem_id="reload_ui")

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 gradio-app/gradio#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

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?

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.