dr413677671 / PromptGallery-stable-diffusion-webui

A prompt cookbook worked as stable-diffusion-webui extenstions.
Apache License 2.0
153 stars 16 forks source link

Use on remote machine #9

Closed Xyem closed 1 year ago

Xyem commented 1 year ago

Having a quick look at the source code, it appears this can't be used when the webui is running on a remote machine, because it only listens on localhost. Am I missing something or can this not (currently?) be used when the webui is running remotely (e.g. accessed via --listen)?

dr413677671 commented 1 year ago

I dont think I fully understand the question.

If you want to expose webui and prompt-gallery to public. You need ngnix.

Within local domain, they can visit each other if the port is not banned.

dr413677671 commented 1 year ago

You could try customized the ip like this in here. But I do not recommend you to do so as it is not safe. ip = any_ip html = """<iframe id="tab_iframe" style="width: 100%; min-height: 1080px; padding: 0;margin: 0;border: none;" src="http://localhost:5173/?theme={theme:s}&port={port:s}&ip={ip:s}" frameborder="0" marginwidth="0" marginheight="0"></iframe>""".format(theme=extension_theme, port=port, ip=ip)

Xyem commented 1 year ago

I have the webui running on ComputerA using --listen which causes the server to listen on 0.0.0.0:7860, making it accessible over the LAN i.e. from ComputerB. Prompt Gallery runs on ComputerA and listens on localhost:5173, so only ComputerA can access it. In the webui on ComputerB, it tries to access localhost:5173 which obviously does nothing as Prompt Gallery isn't running on ComputerB.

The iframe source needs to point to the same place the webui is running and Prompt Gallery needs to listen on 0.0.0.0:5173 when the webui is being used remotely i.e. with --listen.

I don't have this available "to the public", just over LAN.

dr413677671 commented 1 year ago

It is an extension of webui. They should run on the same computer.

If you want to expose them to public. Like I said you need nginx.

If you want to make them two service-like on different devices. You need to figure out the cyber security improvement and how they communicate (like filter, interceptor, task queue and etc.).

Xyem commented 1 year ago

I am running webui and Prompt Gallery on the same computer, I'm accessing them from a remote computer via the LAN.

I am not making them accessible to the public, I just want to access them remotely (because the VM they are in is headless, so all the GPU VRAM is for Stable Diffusion).

Even if I used nginx between them it wouldn't work.. you've hard-coded the frame source to be localhost, so it will only even work when the browser is running on the same machine as Prompt Gallery.

dr413677671 commented 1 year ago

Understood, Fixed. but you need to add server-name in param. Please refer to readme