stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

automatic1111 new frontend using DiffusionUI

Open leszekhanusz opened this issue 2 years ago • 28 comments

Hi,

I modified my GUI Stable Diffusion frontend to be able to use the automatic1111 fork as a backend.

Advantages over the normal interface:

  • Better inpainting with possibility to draw inside the inpainted regions (very useful to direct the image where you want it to go!)
  • responsive design
  • Seamless switch from text-to-img, img2img, inpainting and upscaling
  • Each image previously generated is saved in a gallery in the right tab (until you close your browser). Each image (even in a large batch of images) can be edited (inpainted or variations) or regenerated again (saving all the parameters, seed, and strokes in the image editor so that you can select only one image you like in a large batch and regenerate it)
  • all the parameters are saved in local storage in the browser

Testing it is very easy:

  • Start a recent version of the automatic1111 webui to have its api listening on port 7860
  • go to https://diffusionui.com
  • open the left tab and select the automatic1111 fork from the dropdown

Send a GitHub star my way if like it!

Note: the gradio API is changing quite fast here so I cannot guarantee that it'll work after an update here. It's currently working with the current commit (f2a4a2c3a672e22f088a7455d6039557370dd3f2)

Some screenshots:

start_screen left_panel main_screen gallery

leszekhanusz avatar Sep 28 '22 04:09 leszekhanusz

I got "Error! The backend returned the http code: 500"

At the console it says TypeError: string indices must be integers


Even though it doesn't work for me, I can still give feedback,

I do like some of the ideas behind this UI. I like the fluidness of the menus and sliders, and the better use of the widescreen.

However, I don't like that I can't enter prompts with the sliders visible. I also don't like the lack of multi-line prompt support.

When I am working on finetuning an image I have many rows of prompt entries and adjust sliders many many times before the image is the way I like it.

I have 21:9 Ultra wide monitors and would love a UI to adjust in a way that allows me to better use my screen space. I suggest you allow people to "pin" the slider and image viewer open. And allow the prompt entry to scale to support multiple lines. This way you can have both. A clean UI or a useful one.

MrKuenning avatar Sep 28 '22 04:09 MrKuenning

Could you have an option to put a url as Im not hosting locally but on a server elsewhere, I can expose it and use this front end.

MrAshRhodes avatar Sep 28 '22 07:09 MrAshRhodes

Could you have an option to put a url as Im not hosting locally but on a server elsewhere, I can expose it and use this front end.

This option is there. If you click on the (i) there is a field to modify the API url.

MrKuenning avatar Sep 28 '22 07:09 MrKuenning

Could you have an option to put a url as Im not hosting locally but on a server elsewhere, I can expose it and use this front end.

This option is there. If you click on the (i) there is a field to modify the API url.

Im a donut, i didnt realise that was clickable/editable... ill test it out some more today 👍

MrAshRhodes avatar Sep 28 '22 07:09 MrAshRhodes

If you can't make it work:

  • you need to ensure you have a version of automatic1111 which is compatible with the current backend definition json file. The current version of this repo should work right now except there is just a new bug which appeared. To go to a working version, you can type git checkout f2a4a2c in the stable-diffusion-webui folder.
  • The port should be 7860 (Running on local URL: http://127.0.0.1:7860). Sometimes it can change to 7861 if you restart the backend too soon. You need to wait a minute and try again if that's the case.
  • you might want to try to click on the "reset to default values" buttons in the model info ( ⓘ ) tab on the left side panel to be sure you have the latest version.
  • You need to ensure that you selected Automatic1111 fork in the first dropdown of the left side panel, not Stable diffusion!

If after all this it still fails, then here is how to debug:

  • In chrome, open the developer tools panel
  • go to the Network tab
  • generate an image with my interface and with the automatic1111 interface and compare the second predict/ call. In the payload you should see the data which is being sent and you can compare both methods to verify that there is no difference.

leszekhanusz avatar Sep 28 '22 08:09 leszekhanusz

Could you have an option to put a url as Im not hosting locally but on a server elsewhere, I can expose it and use this front end.

This option is there. If you click on the (i) there is a field to modify the API url.

Yes, it is possible to share (using --share parameter in webui.py and providing the generated gradio.app url in the model info tab. It should work on your smartphone too this way. Note: you need to set the complete path of the api (with /api/predict) at the end. It should look like this: https://12345.gradio.app/api/predict/

A problem right now is that it does not work with authentication (you can't use the --gradio-auth parameter). I can't make it work because of CORS. See this issue for reference.

leszekhanusz avatar Sep 28 '22 08:09 leszekhanusz

I am getting a different error when trying to use it:

Traceback (most recent call last):
  File "/home/bernard/stable-diffusion-webui/venv/lib/python3.9/site-packages/gradio/routes.py", line 273, in run_predict
    output = await app.blocks.process_api(
  File "/home/bernard/stable-diffusion-webui/venv/lib/python3.9/site-packages/gradio/blocks.py", line 739, in process_api
    inputs = self.preprocess_data(fn_index, inputs, state)
  File "/home/bernard/stable-diffusion-webui/venv/lib/python3.9/site-packages/gradio/blocks.py", line 638, in preprocess_data
    processed_input.append(block.preprocess(raw_input[i]))
  File "/home/bernard/stable-diffusion-webui/venv/lib/python3.9/site-packages/gradio/components.py", line 1067, in preprocess
    return self.choices.index(x)
ValueError: False is not in list

bmaltais avatar Sep 28 '22 13:09 bmaltais

@bmaltais did you follow all the recommendations in this comment ?

leszekhanusz avatar Sep 28 '22 13:09 leszekhanusz

Does it actually work for someone else than me?

leszekhanusz avatar Sep 28 '22 13:09 leszekhanusz

However, I don't like that I can't enter prompts with the sliders visible. I also don't like the lack of multi-line prompt support.

When I am working on finetuning an image I have many rows of prompt entries and adjust sliders many many times before the image is the way I like it.

I have 21:9 Ultra wide monitors and would love a UI to adjust in a way that allows me to better use my screen space. I suggest you allow people to "pin" the slider and image viewer open. And allow the prompt entry to scale to support multiple lines. This way you can have both. A clean UI or a useful one.

@MrKuenning Thanks for the feedback! Your suggestion to be able to leave the sidebars open is a very good one. It is now implemented :+1:

wide_screen

leszekhanusz avatar Sep 28 '22 16:09 leszekhanusz

still getting The backend returned the http code: 500 I guess this should be more error proof and report a message thats clear to user " code 500 tells me 0 Also the inpaint thing, it doesnt work in full res? so you only upscale a face from giant poster ? thats not an improvement

1blackbar avatar Sep 28 '22 17:09 1blackbar

@1blackbar did you follow all the recommendations in this comment?

Yes, full res inpainting is not yet implemented right now. It's on top of my to do list

leszekhanusz avatar Sep 28 '22 17:09 leszekhanusz

Hey I really need your help guys, multiple persons are reporting it not working but they don't answer my questions so I don't know if they've an older version of the automatic1111 fork or if there is really a problem. It works well on my machine of course.

To all the persons who had problems, does the problem still appears after you run git checkout f2a4a2c3a672e22f088a7455d6039557370dd3f2 to get to a specific automatic1111 backend version?

leszekhanusz avatar Sep 28 '22 19:09 leszekhanusz

what error 500 does lets start with that, yes i did whats in the comment , frontend still not working while i generate in this webui all the time so i really have no way to tell more about it Also i prefere not to update to todays version , maybe in a few days when issue will be worked out, siome things broke according to some issues here.Im on version from like 2 days ago But looks like its trying to connect, theres this in cmd

Traceback (most recent call last): File "D:\sd\venv\lib\site-packages\gradio\routes.py", line 273, in run_predict output = await app.blocks.process_api( File "D:\sd\venv\lib\site-packages\gradio\blocks.py", line 739, in process_api inputs = self.preprocess_data(fn_index, inputs, state) File "D:\sd\venv\lib\site-packages\gradio\blocks.py", line 638, in preprocess_data processed_input.append(block.preprocess(raw_input[i])) File "D:\sd\venv\lib\site-packages\gradio\components.py", line 2118, in preprocess return process_single_file(x) File "D:\sd\venv\lib\site-packages\gradio\components.py", line 2088, in process_single_file f["name"], TypeError: string indices must be integers

1blackbar avatar Sep 28 '22 20:09 1blackbar

@bmaltais did you follow all the recommendations in this comment ?

I did not. I will try it again tonight. I used it with the latest code available at the time of testing.

bmaltais avatar Sep 28 '22 20:09 bmaltais

@1blackbar 500 is the http code and means "Internal Server Error". I'm afraid I have no way to have more info about the error in the brower in this case and you have to see the error in the console.

But if you haven't updated to the recent version it won't work, it's perfectly normal that it does not work, they made changes very recently and the API changed so you should really try to go to the same automatic1111 version to test it.

Run git checkout f2a4a2c3a672e22f088a7455d6039557370dd3f2, it was before the recent bugs. Once you've tested, you can go back to where you were using git switch -

leszekhanusz avatar Sep 28 '22 20:09 leszekhanusz

I did not. I will try it again tonight. I used it with the latest code available at the time of testing.

Thanks

leszekhanusz avatar Sep 28 '22 20:09 leszekhanusz

looks like nobody is able to run it my man ? Updated to current repo, still error 500 - indices must be integers

1blackbar avatar Sep 28 '22 21:09 1blackbar

please try with git checkout f2a4a2c3a672e22f088a7455d6039557370dd3f2 ...

leszekhanusz avatar Sep 28 '22 21:09 leszekhanusz

Alright, making progress, I tried under Windows and got the same error, even with the commit working under Linux. Investigating ...

leszekhanusz avatar Sep 28 '22 22:09 leszekhanusz

finally youre one of us !

1blackbar avatar Sep 28 '22 22:09 1blackbar

Found the problem, the scripts are not loaded in the same order on Linux and on Windows, causing the API to be different. I made the PR #1276 to fix this and I'll reorder the fields in my json file.

leszekhanusz avatar Sep 28 '22 23:09 leszekhanusz

This should work now when selecting Automatic1111 sorted as the backend and using the PR to fix the sort order.

How to make it work right now:

  • Run git fetch origin pull/1276/head && git checkout FETCH_HEAD in the stable-diffusion-webui folder to have a version of automatic1111 with sorted scripts
  • Launch the automatic1111 webui
  • go to https://diffusionui.com
  • select "Automatic1111 sorted" in the dropdown at the top of the left panel

I hope it works for you and sorry for the confusion.

leszekhanusz avatar Sep 29 '22 01:09 leszekhanusz

Does https://diffusionui.com/ front end online record user's prompt?

13700k avatar Sep 29 '22 02:09 13700k

Does https://diffusionui.com/ front end online record user's prompt?

No, it records nothing. Everything passes directly from the backend to your browser. But the latest prompt and all the other parameters are saved in your browser in local storage.

leszekhanusz avatar Sep 29 '22 02:09 leszekhanusz

This doesn't seem to work anymore. It generates an image then it disappears.

MrKuenning avatar Oct 21 '22 20:10 MrKuenning

This doesn't seem to work anymore. It generates an image then it disappears.

I don't have access to my computer until tomorrow. I'll check it then. It should work with at least the automatic1111 version from yesterday.

leszekhanusz avatar Oct 21 '22 20:10 leszekhanusz

@MrKuenning I just tested with the latest automatic1111 version and it works correctly for me, without modification. If you still have a problem, please report it on my repo, and please mention:

  • which commit of automatic1111 you are using
  • your OS and browser versions
  • how to reproduce your problem
  • a complete log of what's printed in your web console when you have your problem

leszekhanusz avatar Oct 22 '22 17:10 leszekhanusz