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

[Bug]: I do not have /sdapi/v1/txt2img Populating in Stable Diffusion

Open River-Kosmos opened this issue 1 year ago • 8 comments

Is there an existing issue for this?

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

What happened?

I am trying to have WebUI to generate text images through Stable Diffusion. When executing through WEB UI with the correct server for it to access Stable Diffusion. It gives me this Error.

404 Client Error: Not Found for url: http://127.0.0.1:7861/sdapi/v1/txt2img

I went to add --api to the batch file on Stable Diffusion and went through the Doc to discover that it is not located there. I have tried to update Stable Diff. A1111 to 1.6. I still have no success. I was wondering if anyone has gotten to this point with no progress or that I am just completely missing something here.

Steps to reproduce the problem

  1. Have WebUI and A1111 running.
  2. Make sure Batch File was set correctly
  3. Make sure all extensions and flags are correct.
  4. Have WEBUI generate an Image by the server address that is of A1111

What should have happened?

The TextUI should have used Stable Diffusion to produce an image.

Sysinfo

"Platform": "Windows-10-10.0.22621-SP0", "Python": "3.10.9", "Version": "v1.6.0", "Commit": "5ef669de080814067961f28357256e8fe27544f4", "Script path": "C:\Users\natha\AI\A1111\stable-diffusion-webui", "Data path": "C:\Users\natha\AI\A1111\stable-diffusion-webui", "Extensions dir": "C:\Users\natha\AI\A1111\stable-diffusion-webui\extensions", "Checksum": "1bcaf7df11c14e69a56b7c40107d9d48a229757d301f05d0064db23bd4afc5e9", "Commandline": [ "launch.py" ], "Torch env info": { "torch_version": "2.0.1+cu118", "is_debug_build": "False", "cuda_compiled_version": "11.8", "gcc_version": null, "clang_version": null, "cmake_version": null, "os": "Microsoft Windows 11 Home", "libc_version": "N/A", "python_version": "3.10.9 | packaged by Anaconda, Inc. | (main, Mar 8 2023, 10:42:25) [MSC v.1916 64 bit (AMD64)] (64-bit runtime)", "python_platform": "Windows-10-10.0.22621-SP0", "is_cuda_available": "True", "cuda_runtime_version": null, "cuda_module_loading": "LAZY", "nvidia_driver_version": "536.67", "nvidia_gpu_models": "GPU 0: NVIDIA GeForce RTX 4070", "cudnn_version": null, "pip_version": "pip3", "pip_packages": [ "numpy==1.23.5", "open-clip-torch==2.20.0", "pytorch-lightning==1.9.4", "torch==2.0.1+cu118", "torchdiffeq==0.2.3", "torchmetrics==1.1.1", "torchsde==0.2.5", "torchvision==0.15.2+cu118" ], "conda_packages": [ "numpy 1.24.0 pypi_0 pypi", "torch 2.0.1+cu117 pypi_0 pypi", "torchaudio 2.0.2+cu117 pypi_0 pypi", "torchvision 0.15.2+cu117 pypi_0 pypi" ],

What browsers do you use to access the UI ?

Other

Console logs

File "C:\Users\natha\anaconda3\envs\textgen\lib\site-packages\gradio\routes.py", line 427, in run_predict
    output = await app.get_blocks().process_api(
  File "C:\Users\natha\anaconda3\envs\textgen\lib\site-packages\gradio\blocks.py", line 1323, in process_api
    result = await self.call_function(
  File "C:\Users\natha\anaconda3\envs\textgen\lib\site-packages\gradio\blocks.py", line 1067, in call_function
    prediction = await utils.async_iteration(iterator)
  File "C:\Users\natha\anaconda3\envs\textgen\lib\site-packages\gradio\utils.py", line 336, in async_iteration
    return await iterator.__anext__()
  File "C:\Users\natha\anaconda3\envs\textgen\lib\site-packages\gradio\utils.py", line 329, in __anext__
    return await anyio.to_thread.run_sync(
  File "C:\Users\natha\anaconda3\envs\textgen\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "C:\Users\natha\anaconda3\envs\textgen\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "C:\Users\natha\anaconda3\envs\textgen\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "C:\Users\natha\anaconda3\envs\textgen\lib\site-packages\gradio\utils.py", line 312, in run_sync_iterator_async
    return next(iterator)
  File "C:\Users\natha\AI\text-generation-webui\modules\chat.py", line 305, in generate_chat_reply_wrapper
    for i, history in enumerate(generate_chat_reply(text, state, regenerate, _continue, loading_message=True)):
  File "C:\Users\natha\AI\text-generation-webui\modules\chat.py", line 290, in generate_chat_reply
    for history in chatbot_wrapper(text, state, regenerate=regenerate, _continue=_continue, loading_message=loading_message):
  File "C:\Users\natha\AI\text-generation-webui\modules\chat.py", line 261, in chatbot_wrapper
    output['visible'][-1][1] = apply_extensions('output', output['visible'][-1][1], state, is_chat=True)
  File "C:\Users\natha\AI\text-generation-webui\modules\extensions.py", line 223, in apply_extensions
    return EXTENSION_MAP[typ](*args, **kwargs)
  File "C:\Users\natha\AI\text-generation-webui\modules\extensions.py", line 81, in _apply_string_extensions
    text = func(*args, **kwargs)
  File "C:\Users\natha\AI\text-generation-webui\extensions\sd_api_pictures\script.py", line 219, in output_modifier
    string = get_SD_pictures(string, state['character_menu']) + "\n" + text
  File "C:\Users\natha\AI\text-generation-webui\extensions\sd_api_pictures\script.py", line 158, in get_SD_pictures
    response.raise_for_status()
  File "C:\Users\natha\anaconda3\envs\textgen\lib\site-packages\requests\models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://127.0.0.1:7861/sdapi/v1/txt2img

Additional information

No response

River-Kosmos avatar Sep 15 '23 21:09 River-Kosmos

Note - Browsers I have used are Edge, Chrome and Fire Fox.

River-Kosmos avatar Sep 15 '23 21:09 River-Kosmos

I'm not sure why you would have a modules\chat.py in the modules directory last I checked that's not a part of web UI

w-e-w avatar Sep 17 '23 05:09 w-e-w

Maybe it's not the correct URL.

Try with the following: http://127.0.0.1:7860/sdapi/v1/txt2img

The correct default port is 7860 for local stable diffusion install on windows.

Okarels avatar Sep 19 '23 13:09 Okarels

404 Client Error: Not Found for url: http://127.0.0.1:7861/sdapi/v1/txt2img

same issue and from doc also this endpoint was removed. please suggest the some way to get the solution for the same

Tejasdavande07 avatar Nov 02 '23 02:11 Tejasdavande07

404 Client Error: Not Found for url: http://127.0.0.1:7861/sdapi/v1/txt2img

same issue and from doc also this endpoint was removed. please suggest the some way to get the solution for the same

Facing the same issue here. Any update on this?

13Flo avatar Mar 02 '24 10:03 13Flo

open the webui.bat present inside the stable diffusion

edit this file in editor as mentioned below ->


set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS=--api

Tejasdavande07 avatar Mar 02 '24 12:03 Tejasdavande07

In my case the solution was modifying the webui-user.bat file as follows:

set PYTHON= set GIT= set VENV_DIR= set COMMANDLINE_ARGS=--api

After making these changes, I proceeded to open 'webui-user.bat' instead of 'webui.bat'.

cristian495 avatar Mar 20 '24 19:03 cristian495

add arg --api when starting webui.

According to webui wiki.

suyi91 avatar Mar 27 '24 06:03 suyi91