rupeshs / fastsdcpu

Fast stable diffusion on CPU
MIT License
1k stars 87 forks source link

Update CLI interactive mode #139

Closed monstruosoft closed 4 months ago

monstruosoft commented 4 months ago

CLI interactive mode now works with all supported image generation modes: txt2img, img2img, Image variations, EDSR upscale and SD upscale.

At first I attempted to write a basic curses-based interface but that resulted in messed up console output because of the rest of the code is not written with a curses interface in mind, so in the end I decided to write a most simple interface. I've tried all possible modes and combinations (interactive and non-interactive, GUI and WebUI) and I think it's all working as expected.

Some CLI interactive modes, in particular SD upscale, might require some extra work to allow configuring custom settings.

If you have some coding style rules, let me know, so that you don't have to edit the changes just for coding style.

rupeshs commented 4 months ago

@monstruosoft Does this works on Windows (curses?)

monstruosoft commented 4 months ago

I'm not sure, don't have a Windows machine to try it, but in the end I didn't use curses, it's just plain console input and output routines.

rupeshs commented 4 months ago

I'm not sure, I don't have a Windows machine to try it, but in the end I didn't use curses, it's just plain console input and output routines.

@monstruosoft I have added a few review comments. For coding follow these style :

You can also use Ruff with IDE.

monstruosoft commented 4 months ago

Give a better name instead of c

I used a single letter because I thought that would make the code shorter and easier to read; if I use a longer name I might as well just use the whole config.lcm_diffusion_setting instead, but OK, I'll review the code.

Remove unused imports

Right, missed that one.

Write code in a cross-platform way (Windows/Linux/Mac)

Isn't Python by itself cross-platform?.

Gonna make the necessary changes. Thanks.

rupeshs commented 4 months ago

Give a better name instead of c

I used a single letter because I thought that would make the code shorter and easier to read; if I use a longer name I might as well just use the whole config.lcm_diffusion_setting instead, but OK, I'll review the code.

Remove unused imports

Right, missed that one.

Write code in a cross-platform way (Windows/Linux/Mac)

Isn't Python by itself cross-platform?.

Gonna make the necessary changes. Thanks.

If we use platform-specific Python packages it causes trouble for example pywin32. We need to ensure it works on all FastSD platforms.

monstruosoft commented 4 months ago

I've improved CLI interactive mode and used black for code formatting. The code is not pretty but it allows customizing every possible useful setting I could think of, so that you can now use CLI interactive mode simply by running FastSD as:

# python src/app.py -i

I made a lot of test runs to make sure it works well, I hope I didn't miss anything.

rupeshs commented 4 months ago

I've improved CLI interactive mode and used black for code formatting. The code is not pretty but it allows customizing every possible useful setting I could think of, so that you can now use CLI interactive mode simply by running FastSD as:

# python src/app.py -i

I made a lot of test runs to make sure it works well, I hope I didn't miss anything.

Thanks, Could you please resolve all review comments?

monstruosoft commented 4 months ago

Done.

rupeshs commented 4 months ago

@monstruosoft Thank you for this wonderful PR.