zanllp/sd-webui-infinite-image-browsing

How do I get the extension to work without the interface on the colab version?

Loli-Kyn opened this issue · 11 comments

C did what was said in topic #47, but it didn't work. Can you tell me step by step what I should do?

246688090-5b6bd52d-5526-4b1e-beba-1ce9c165cfe5

zanllp commented

I feel like this person has already explained it well.

image
WSH032 commented

@Loli-Kyn
ok, let's continue from #47 (comment)

you said,

but it doesn't show my pictures.

I dont understand.

You mean colab dont display iframe? Or you mean config.json didn't work?

For the first one, try this:

from google.colab.output import serve_kernel_port_as_iframe, serve_kernel_port_as_window
from google.colab import output
from threading import Thread
import time

!git clone https://github.com/zanllp/sd-webui-infinite-image-browsing.git
%cd sd-webui-infinite-image-browsing
!pip install -r requirements.txt
output.clear()

port = 7888  # your port
config_file = "your_sd_webui_config_path"

def run_app():
    !python app.py --port={port}  # --sd_webui_config={config_file} # if you want

thread = Thread(target=run_app)
thread.start()
time.sleep(0.1)
# serve_kernel_port_as_window(port)  # it also work, use which one is up to you
serve_kernel_port_as_iframe(port)

# thread.join()  # if you want execute synchronously

It work well for me.

M2K`OV@N{N64I{~A6$HM071

For the second one

I dont konw how cagliostro-colab-ui work
So, i can't offer help
Sorry about that.

WSH032 commented

emm...
It seems like Colab's problem
I have encountered it once before, but i have no idea to solve it.
May be restarting Colab will help

@WSH032 Should I try changing the colab(diffusion) and check?

WSH032 commented

@Loli-Kyn No, you don't need to change anything, just try again.

refer to #261

# install
from google.colab.output import serve_kernel_port_as_iframe, serve_kernel_port_as_window
from google.colab import output
import sys
import os

!git clone https://github.com/zanllp/sd-webui-infinite-image-browsing.git
%cd sd-webui-infinite-image-browsing
!pip install -r requirements.txt
sys.path.append( os.getcwd() )
output.clear()
# launch
import app  # after pip

port = 9998  # change by yourself # your port
extra_paths = [ "your_extra_paths" ] # change by yourself # type: List[str]
sd_webui_config = "your_sd_webui_config_path"  # change by yourself
update_image_index = True  # change by yourself

serve_kernel_port_as_iframe(port)

await app.async_launch_app(
    port = port,
    extra_paths = extra_paths,
    update_image_index = update_image_index,
    sd_webui_config = sd_webui_config,
)

84AAN13%YZ6@$B9E 4_F)XR


by the way, may be you should need to change the extension name, because Colab prohibits running code with webui characters

@WSH032 I still don't understand...

I successfully ran the code mentioned in my ColabNotebook, and everything was indexed and fine. I am testing now
to see if things are running more smooth than before, as caching didnt work previously. I see the .db file now has increased
after the indexing.

Open in Colab

Seems my question is this, when I run the extension inside stable diffusion webui - doesnt it index and run smooth there ? Your code above indexes and runs quicker, but when I launch through the webui it doesnt seem to index or buffer anything?

You can refer to or directly use this.

https://github.com/Linaqruf/sd-notebook-collection/blob/main/Infinite_Image_Browsing_Demo.ipynb

I have tried this one, however I have a question. Is this supposed to buffer or preload any data, to me it loads very slow and does not buffer / cache any data it seems. So each time I reenter a folder, all images / thumbs needs to be recalculated ? Is this correct?

zanllp commented

I have tried this one, however I have a question. Is this supposed to buffer or preload any data, to me it loads very slow and does not buffer / cache any data it seems. So each time I reenter a folder, all images / thumbs needs to be recalculated ? Is this correct?

By default, IIB will compress images into 512x512 webp format and save them in the system's temporary folder. For example, a 1024x1024 PNG image that is about 1MB in size will be compressed to around 30KB. This is typically very beneficial. However, for platforms like Colab where a different machine may be allocated each time you start, you may need to regenerate the cache each time. You can choose to turn off thumbnail previews or save the cache folder to restore it for future use.

Optimization can be achieved by saving and restoring the /path/to/system/temp/dir/iib_cache directory and the iib.db file located in the repo root directory.