Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stopped working suddenly, can't visualize #54

Open
MNeMoNiCuZ opened this issue Jun 5, 2023 · 16 comments
Open

Stopped working suddenly, can't visualize #54

MNeMoNiCuZ opened this issue Jun 5, 2023 · 16 comments

Comments

@MNeMoNiCuZ
Copy link

The extension seems to have stopped working for me. Not sure when.
Whenever I press Visualize, I get an ERROR in the preview window:
image

The log outputs this:

Traceback (most recent call last):
  File "C:\AI\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 422, in run_predict
    output = await app.get_blocks().process_api(
  File "C:\AI\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1326, in process_api
    data = self.postprocess_data(fn_index, result["prediction"], state)
  File "C:\AI\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1260, in postprocess_data
    prediction_value = block.postprocess(prediction_value)
  File "C:\AI\stable-diffusion-webui\venv\lib\site-packages\gradio\components.py", line 4457, in postprocess
    file = self.img_array_to_temp_file(img, dir=self.DEFAULT_TEMP_DIR)
  File "C:\AI\stable-diffusion-webui\venv\lib\site-packages\gradio\components.py", line 355, in img_array_to_temp_file
    return self.pil_to_temp_file(pil_image, dir, format="png")
TypeError: save_pil_to_file() got an unexpected keyword argument 'format'

And it has worked great up until now.
I'm on

version: [v1.3.2](https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/baf6946e06249c5af9851c60171692c44ef633e0)  •  python: 3.10.9  •  torch: 2.0.0+cu118  •  xformers: 0.0.17  •  gradio: 3.32.0  •  checkpoint: [e4a56fa397]

with the latest version of two-shot:

stable-diffusion-webui-two-shot | https://github.com/opparco/stable-diffusion-webui-two-shot | main | 9936c52e | Sun Feb 19 08:40:41 2023 | latest
@sanovskiy
Copy link

Having the same issue.

@itsui
Copy link

itsui commented Jun 6, 2023

same here

@MADM1k33
Copy link

MADM1k33 commented Jun 6, 2023

same

@chuckneyejoe
Copy link

same here as well :)

@mestiez
Copy link

mestiez commented Jun 8, 2023

me too!!

@dolce1211
Copy link

same here

@mccabedd
Copy link

mccabedd commented Jun 9, 2023

Installed this extension for the very first time today, and have the exact same error at my end too.

@teeomaan
Copy link

teeomaan commented Jun 9, 2023

Its been 4 days. Any solution so far?

@TimonFugier
Copy link

Hey, I'm not part of the dev on this project and also had the same issue.

I Hotfixed it by modifying the function :
def img_array_to_temp_file(self, arr: np.ndarray, dir: str) -> str:
pil_image = _Image.fromarray(
processing_utils._convert(arr, np.uint8, force_copy=False)
)
return self.pil_to_temp_file(pil_image, dir)

in Automatic1111\stable-diffusion-webui\venv\Lib\site-packages\gradio\components.py

I just changed:
return self.pil_to_temp_file(pil_image, dir, format="png")
to
return self.pil_to_temp_file(pil_image, dir)
on line 355

The problem was the following :
The function img_array_to_temp_file calls pil_to_temp_file (who indeed has the format parameter)
BUT
This function pil_to_temp_file has been overwritten in Automatic1111\stable-diffusion-webui\modules\ui_tempdir.py
# override save to file function so that it also writes PNG info
gradio.components.IOComponent.pil_to_temp_file = save_pil_to_file
AND
The function save_pil_to_file that overwrites pil_to_temp_file does not have a "format" parameter hence the error.

It's hardcoded as "png" with the new function and a default "png" in the old one so you should be fine by applying the hotfix I did.

If they change the save_pil_to_file to allow multiple format it may become interesting to undo the hotfix in the future but it should be good for now at least.

@TimonFugier
Copy link

This repo probably didn't do anything wrong and probably can't do anything to fix the issue. I guess that the real problem is on Automatic1111\stable-diffusion-webui\modules\ui_tempdir.py, i'll be forwarding the issue.

TimonFugier referenced this issue in AUTOMATIC1111/stable-diffusion-webui Jun 9, 2023
@teeomaan
Copy link

teeomaan commented Jun 9, 2023

@TimonFugier thanks so much. It works again.

@biba-samurai228
Copy link

biba-samurai228 commented Jun 25, 2023

Downloaded for the first time, and I am having same error. Any ideas how to fix it? Tried to change to " return self.pil_to_temp_file(pil_image, dir)", but it didn't change anything.

File "H:\SUPER SD 2.0 Dependencies\stable-diffusion-webui-master\venv\lib\site-packages\gradio\routes.py", line 422, in run_predict
output = await app.get_blocks().process_api(
File "H:\SUPER SD 2.0 Dependencies\stable-diffusion-webui-master\venv\lib\site-packages\gradio\blocks.py", line 1326, in process_api
data = self.postprocess_data(fn_index, result["prediction"], state)
File "H:\SUPER SD 2.0 Dependencies\stable-diffusion-webui-master\venv\lib\site-packages\gradio\blocks.py", line 1260, in postprocess_data
prediction_value = block.postprocess(prediction_value)
File "H:\SUPER SD 2.0 Dependencies\stable-diffusion-webui-master\venv\lib\site-packages\gradio\components.py", line 4457, in postprocess
file = self.img_array_to_temp_file(img, dir=self.DEFAULT_TEMP_DIR)
File "H:\SUPER SD 2.0 Dependencies\stable-diffusion-webui-master\venv\lib\site-packages\gradio\components.py", line 355, in img_array_to_temp_file
return self.pil_to_temp_file(pil_image, dir, format="png")
TypeError: save_pil_to_file() got an unexpected keyword argument 'format'

@bluce
Copy link

bluce commented Jun 26, 2023

Modify file
modules\ui_tempdir.py line 34
add param: format="png"

def save_pil_to_file(self, pil_image, dir=None, format="png"):

@ht1ppens
Copy link

ht1ppens commented Jul 2, 2023

changed file modules\ui_tempdir.py line 34 add param: format="png"

def save_pil_to_file(self, pil_image, dir=None, format="png"):

This worked like a charm

@vichoxmaiz
Copy link

Modify file modules\ui_tempdir.py line 34 add param: format="png"

def save_pil_to_file(self, pil_image, dir=None, format="png"):

Thanks master!!

@alphan123nbn
Copy link

i couldn't solve the problem i did the methods mentioned but it still continue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

16 participants