0xbitches / sd-webui-lcm

Latent Consistency Model for AUTOMATIC1111 Stable Diffusion WebUI
MIT License
614 stars 43 forks source link

Fix unicodedecodeerror #18

Closed teftef6220 closed 9 months ago

teftef6220 commented 9 months ago

When starting the WebUI

When trying to read css

nicodeDecodeError: 'cp932' codec can't decode byte 0x97 in position 12023: illegal multibyte sequence

I get an error like this.

I created a function that reads a CSS file in scripts/main.py, encodes css in UTF-8, and used that function to pass the CSS content to gr.Blocks. It works on my enviroment

ljleb commented 9 months ago

By the way, the webui loads any style.css ("style" without an extra "s") at the root of extension directories (source). I'm not totally sure but maybe we can use this to simplify the code?

teftef6220 commented 9 months ago

The code in this extension reads style.css in

~/stable-diffusion-webui/extensions/sd-webui-lcm/scripts/

So I think the css needs to be independent of the style.css in

stable-diffusion-webui/

For example, I believe that style.css may be changed when webui is updated, which could cause an error.

Sorry, I don't clearly understand your comment and replied with this comment. I am sorry if I don't answer your question according to your intention.

ljleb commented 9 months ago

I am confused because there is a file at scripts/styles.css which does not match the name used in this PR (style.css) so the intent is not so clear to me. IIUC the current code loads the css file located at the root of the webui (not this extension), however this file should already be loaded by the webui AFAIK... Am I getting this right?

teftef6220 commented 9 months ago

I see! it's my mistake . thanks

0xbitches commented 9 months ago

I'm thinking about just removing scripts/styles.css since it does not actually do much.

teftef6220 commented 9 months ago

I understand. Shall we close this PR then?

0xbitches commented 9 months ago

Closing this with https://github.com/0xbitches/sd-webui-lcm/commit/40b6bf219eb80bb796ef3974bc710894b63815ea

teftef6220 commented 9 months ago

ty