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

[Bug]: image-to-image won't run. TypeError: string indices must be integers #610

Closed
1 task done
feelie75 opened this issue Sep 4, 2022 · 10 comments
Closed
1 task done
Labels
bug Something isn't working

Comments

@feelie75
Copy link

feelie75 commented Sep 4, 2022

What happened?

I JUST downloaded the repo .zip only an hour ago for both stable-diffusion-main and stable-diffusion-webui. I just installed anaconda an hour ago, newest version.

I copied the *.py files from the webui main folder into the stable-diffusion-main/scripts/ folder as instructed by this youtube tutorial (https://www.youtube.com/watch?v=bu2xwx-6JGk), I generate a text-to-image image, click Push to img2img, then I click Generate on that tab, and it creates these errors:

Traceback (most recent call last):
File "C:\Users\adubr\anaconda3\envs\ldm\lib\site-packages\gradio\routes.py", line 247, in run_predict
output = await app.blocks.process_api(
File "C:\Users\adubr\anaconda3\envs\ldm\lib\site-packages\gradio\blocks.py", line 639, in process_api
processed_input = self.preprocess_data(fn_index, raw_input, state)
File "C:\Users\adubr\anaconda3\envs\ldm\lib\site-packages\gradio\blocks.py", line 543, in preprocess_data
processed_input.append(block.preprocess(raw_input[i]))
File "C:\Users\adubr\anaconda3\envs\ldm\lib\site-packages\gradio\components.py", line 1546, in preprocess
x, mask = x["image"], x["mask"]
TypeError: string indices must be integers
Couldn't find job FuncKey(job_id=UUID('3590e32e-4f70-4bb6-9d8b-fb98d532626d'), func=<function img2img at 0x00000238EDF86B80>) in session "595ebd61422b4371b39f188b21d31c88"
Couldn't find job FuncKey(job_id=UUID('3590e32e-4f70-4bb6-9d8b-fb98d532626d'), func=<function img2img at 0x00000238EDF86B80>) in session "595ebd61422b4371b39f188b21d31c88"

Like I said, I JUST downloaded everything an hour ago, so I should have the most current version, right? Thanks!

Version

0.0.1 (Default)

What browsers are you seeing the problem on?

Firefox

Where are you running the webui?

Windows

Custom settings

No response

Relevant log output

Traceback (most recent call last):
  File "C:\Users\adubr\anaconda3\envs\ldm\lib\site-packages\gradio\routes.py", line 247, in run_predict
    output = await app.blocks.process_api(
  File "C:\Users\adubr\anaconda3\envs\ldm\lib\site-packages\gradio\blocks.py", line 639, in process_api
    processed_input = self.preprocess_data(fn_index, raw_input, state)
  File "C:\Users\adubr\anaconda3\envs\ldm\lib\site-packages\gradio\blocks.py", line 543, in preprocess_data
    processed_input.append(block.preprocess(raw_input[i]))
  File "C:\Users\adubr\anaconda3\envs\ldm\lib\site-packages\gradio\components.py", line 1546, in preprocess
    x, mask = x["image"], x["mask"]
TypeError: string indices must be integers
Couldn't find job FuncKey(job_id=UUID('3590e32e-4f70-4bb6-9d8b-fb98d532626d'), func=<function img2img at 0x00000238EDF86B80>) in session "595ebd61422b4371b39f188b21d31c88"
Couldn't find job FuncKey(job_id=UUID('3590e32e-4f70-4bb6-9d8b-fb98d532626d'), func=<function img2img at 0x00000238EDF86B80>) in session "595ebd61422b4371b39f188b21d31c88"

Code of Conduct

  • I agree to follow this project's Code of Conduct
@feelie75 feelie75 added the bug Something isn't working label Sep 4, 2022
@feelie75
Copy link
Author

feelie75 commented Sep 4, 2022

Reading the old closed issues of this happening, the work-around still works: Click MASK, then click 'x' to clear the mask, then click back to CROP, then click generate and that fixes the problem, no errors when I do that work-around.

@TFWol
Copy link

TFWol commented Sep 4, 2022

Reading the old closed issues of this happening, the work-around still works: Click MASK, then click 'x' to clear the mask, then click back to CROP, then click generate and that fixes the problem, no errors when I do that work-around.

Thanks, this worked for me.

@codedealer
Copy link
Collaborator

Investigating

@hlky
Copy link
Contributor

hlky commented Sep 4, 2022

Been investigating this, it seems to be a ui issue related to the 2 different gr.Image, how they are given to the functions, and possibly something related to the default image

My changes so far: https://github.com/hlky/stable-diffusion-webui/tree/img2img-fix

If you could test and report back I can get this merged

What works:

  • Loading image to crop
    image

  • Keep masked area (ignore the selection, I had already started the regenerate masked area tests when I took the screenshot)
    image
    image

  • Regenerate masked area
    image
    image

What doesn't work:
Switching crop -> mask doesn't move the image
Probably the resize modes, untested
???

Untested:
"Uncrop" mode

@hlky
Copy link
Contributor

hlky commented Sep 4, 2022

@feelie75

I copied the *.py files from the webui main folder into the stable-diffusion-main/scripts/ folder as instructed by this youtube tutorial (https://www.youtube.com/watch?v=bu2xwx-6JGk)

Would be better if tutorials didn't go against the very clear instructions to not use the dev repo directly though 🤷

@telemole
Copy link

telemole commented Sep 4, 2022

I tried this im2img-fix branch and I'm still getting errors on anything I try to generate in img2img :

sd | Traceback (most recent call last):
sd | File "/opt/conda/envs/ldm/lib/python3.8/site-packages/gradio/routes.py", line 247, in run_predict
sd | output = await app.blocks.process_api(
sd | File "/opt/conda/envs/ldm/lib/python3.8/site-packages/gradio/blocks.py", line 639, in process_api
sd | processed_input = self.preprocess_data(fn_index, raw_input, state)
sd | File "/opt/conda/envs/ldm/lib/python3.8/site-packages/gradio/blocks.py", line 543, in preprocess_data
sd | processed_input.append(block.preprocess(raw_input[i]))
sd | File "/opt/conda/envs/ldm/lib/python3.8/site-packages/gradio/components.py", line 1563, in preprocess
sd | mask_im = processing_utils.decode_base64_to_image(mask)
sd | File "/opt/conda/envs/ldm/lib/python3.8/site-packages/gradio/processing_utils.py", line 28, in decode_base64_to_image
sd | content = encoding.split(";")[1]
sd | AttributeError: 'NoneType' object has no attribute 'split'

@codedealer
Copy link
Collaborator

I think you're just running it with empty prompt which is not supported

@telemole
Copy link

telemole commented Sep 4, 2022

I've done a complete re-install - brought over the new branch files - txt2img works, but img2img (with prompt) :
image

fails and console has same errors :
sd | Traceback (most recent call last):
sd | File "/opt/conda/envs/ldm/lib/python3.8/site-packages/gradio/routes.py", line 247, in run_predict
sd | output = await app.blocks.process_api(
sd | File "/opt/conda/envs/ldm/lib/python3.8/site-packages/gradio/blocks.py", line 639, in process_api
sd | processed_input = self.preprocess_data(fn_index, raw_input, state)
sd | File "/opt/conda/envs/ldm/lib/python3.8/site-packages/gradio/blocks.py", line 543, in preprocess_data
sd | processed_input.append(block.preprocess(raw_input[i]))
sd | File "/opt/conda/envs/ldm/lib/python3.8/site-packages/gradio/components.py", line 1563, in preprocess
sd | mask_im = processing_utils.decode_base64_to_image(mask)
sd | File "/opt/conda/envs/ldm/lib/python3.8/site-packages/gradio/processing_utils.py", line 28, in decode_base64_to_image
sd | content = encoding.split(";")[1]
sd | AttributeError: 'NoneType' object has no attribute 'split'

@mchaker
Copy link
Contributor

mchaker commented Sep 6, 2022

There is a fix in the img2img-fix branch. See comment: #664 (comment)

@codedealer
Copy link
Collaborator

fixes have been merged to master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants