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

[Bug]: sending to img2img from image browser causes error

Open gsgoldma opened this issue 2 years ago • 10 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

tried to send images from the image browser to im2img and the image box overlays an error symbol and this error outputs: Traceback (most recent call last): File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 321, in run_predict output = await app.blocks.process_api( File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1015, in process_api result = await self.call_function(fn_index, inputs, iterator, request) File "D:\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 856, in call_function prediction = await anyio.to_thread.run_sync( File "D:\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "D:\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "D:\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 867, in run result = context.run(func, *args) File "D:\stable-diffusion-webui\modules\generation_parameters_copypaste.py", line 110, in send_image_and_dimensions img = image_from_url_text(x) File "D:\stable-diffusion-webui\modules\generation_parameters_copypaste.py", line 57, in image_from_url_text image = Image.open(io.BytesIO(filedata)) File "D:\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 3147, in open raise UnidentifiedImageError( PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x000001AAAC8DAB10>

Steps to reproduce the problem

  1. Go to ....
  2. Press ....
  3. ...

What should have happened?

normal operation

Commit where the problem happens

251ecee6949c36e9df1d99a950b3e1af2b5fa2b6

What platforms do you use to access UI ?

No response

What browsers do you use to access the UI ?

No response

Command Line Arguments

No response

Additional information, context and logs

No response

gsgoldma avatar Jan 02 '23 22:01 gsgoldma

may be due to new gradio version?

ClashSAN avatar Jan 03 '23 02:01 ClashSAN

send to extras = ERROR for me

manafoo avatar Jan 03 '23 16:01 manafoo

Duplicate of #6198

Also occurs for me and I'm not using Gradio. Details in the other ticket.

Veraxus avatar Jan 03 '23 17:01 Veraxus

I can confirm it with 8f96f9289981a66741ba770d14f3d27ce335a0fb commit, too.

Traceback (most recent call last):
  File "O:\AI\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 321, in run_predict
    output = await app.blocks.process_api(
  File "O:\AI\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1015, in process_api
    result = await self.call_function(fn_index, inputs, iterator, request)
  File "O:\AI\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 856, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "O:\AI\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "O:\AI\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "O:\AI\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "O:\AI\stable-diffusion-webui\modules\generation_parameters_copypaste.py", line 110, in send_image_and_dimensions
    img = image_from_url_text(x)
  File "O:\AI\stable-diffusion-webui\modules\generation_parameters_copypaste.py", line 57, in image_from_url_text
    image = Image.open(io.BytesIO(filedata))
  File "O:\AI\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 3147, in open
    raise UnidentifiedImageError(
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x00000209AF0CC9F0>

mart-hill avatar Jan 03 '23 18:01 mart-hill

With 3e22e294135ed0327ce9d9738655ff03c53df3c0 commit, it's still an issue. Sending to Extras is fixed now, though, thanks!

mart-hill avatar Jan 03 '23 20:01 mart-hill

Confirming what @mart-hill observed. Sending images to extras now works, but sending them to img2img still results in errors.

Traceback (most recent call last):
  File "C:\Users\matt\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 321, in run_predict
    output = await app.blocks.process_api(
  File "C:\Users\matt\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1015, in process_api
    result = await self.call_function(fn_index, inputs, iterator, request)
  File "C:\Users\matt\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 856, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "C:\Users\matt\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Users\matt\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "C:\Users\matt\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "C:\Users\matt\stable-diffusion-webui\modules\generation_parameters_copypaste.py", line 113, in send_image_and_dimensions
    img = image_from_url_text(x)
  File "C:\Users\matt\stable-diffusion-webui\modules\generation_parameters_copypaste.py", line 60, in image_from_url_text
    image = Image.open(io.BytesIO(filedata))
  File "C:\Users\matt\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 3147, in open
    raise UnidentifiedImageError(
PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x000002B5776B5B20>
Traceback (most recent call last):
  File "C:\Users\matt\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 321, in run_predict
    output = await app.blocks.process_api(
  File "C:\Users\matt\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1015, in process_api
    result = await self.call_function(fn_index, inputs, iterator, request)
  File "C:\Users\matt\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 856, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "C:\Users\matt\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Users\matt\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "C:\Users\matt\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 867, in run
    result = context.run(func, *args)
  File "C:\Users\matt\stable-diffusion-webui\modules\generation_parameters_copypaste.py", line 113, in send_image_and_dimensions
    img = image_from_url_text(x)
  File "C:\Users\matt\stable-diffusion-webui\modules\generation_parameters_copypaste.py", line 59, in image_from_url_text
    filedata = base64.decodebytes(filedata.encode('utf-8'))
  File "C:\Users\matt\AppData\Local\Programs\Python\Python310\lib\base64.py", line 562, in decodebytes
    return binascii.a2b_base64(s)
binascii.Error: Invalid base64-encoded string: number of data characters (125) cannot be 1 more than a multiple of 4

Veraxus avatar Jan 03 '23 20:01 Veraxus

can confirm issue is persistent in 5f4fa942b8ec3ed3b15a352903489d6f9e6eb46e

Xerophayze avatar Jan 05 '23 02:01 Xerophayze

To create a public link, set share=True in launch(). Traceback (most recent call last): File "H:\Personal\hobbies\AI-Art\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 321, in run_predict output = await app.blocks.process_api( File "H:\Personal\hobbies\AI-Art\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1015, in process_api result = await self.call_function(fn_index, inputs, iterator, request) File "H:\Personal\hobbies\AI-Art\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 856, in call_function prediction = await anyio.to_thread.run_sync( File "H:\Personal\hobbies\AI-Art\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "H:\Personal\hobbies\AI-Art\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "H:\Personal\hobbies\AI-Art\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 867, in run result = context.run(func, *args) File "H:\Personal\hobbies\AI-Art\stable-diffusion-webui\modules\generation_parameters_copypaste.py", line 113, in send_image_and_dimensions img = image_from_url_text(x) File "H:\Personal\hobbies\AI-Art\stable-diffusion-webui\modules\generation_parameters_copypaste.py", line 60, in image_from_url_text image = Image.open(io.BytesIO(filedata)) File "H:\Personal\hobbies\AI-Art\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 3283, in open raise UnidentifiedImageError(msg) PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x000001B83276CE00>

Xerophayze avatar Jan 05 '23 02:01 Xerophayze

every time i send an image to img2img i get this:

Traceback (most recent call last): File "C:\Users\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 337, in run_predict output = await app.get_blocks().process_api( File "C:\Users\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1015, in process_api result = await self.call_function( File "C:\Users\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 833, in call_function prediction = await anyio.to_thread.run_sync( File "C:\Users\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "C:\Users\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "C:\Users\stable-diffusion-webui\venv\lib\site-packages\anyio_backends_asyncio.py", line 867, in run result = context.run(func, *args) File "C:\Users\stable-diffusion-webui\modules\generation_parameters_copypaste.py", line 114, in send_image_and_dimensions img = image_from_url_text(x) File "C:\Users\stable-diffusion-webui\modules\generation_parameters_copypaste.py", line 62, in image_from_url_text filedata = base64.decodebytes(filedata.encode('utf-8')) File "C:\Users\AppData\Local\Programs\Python\Python310\lib\base64.py", line 562, in decodebytes return binascii.a2b_base64(s) binascii.Error: Incorrect padding

gillopillo avatar Jan 27 '23 19:01 gillopillo

return binascii.a2b_base64(s) binascii.Error: Incorrect padding

For this error. check here: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/6582#issuecomment-1405831403

AlUlkesh avatar Jan 27 '23 19:01 AlUlkesh