Is there an existing issue for this?
What happened?
when CALL txt2img api, return 500 Internal Server Error : {'error': 'AttributeError', 'detail': '', 'body': '', 'errors': 'click() and other events can only be called within a Blocks context.'}.
restart program can temporarily resolve this problem.
Steps to reproduce the problem
possible occurrence when start program
What should have happened?
API return 200 and works fine
Commit where the problem happens
89f9faa
What Python version are you running on ?
Python 3.10.x
What platforms do you use to access the UI ?
Linux
What device are you running WebUI on?
No response
What browsers do you use to access the UI ?
No response
Command Line Arguments
--no-download-sd-model --autolaunch --nowebui --api
List of extensions
No
Console logs
API error: POST: /sdapi/v1/txt2img {'error': 'AttributeError', 'detail': '', 'body': '', 'errors': 'click() and other events can only be called within a Blocks context.'}
INFO: None:0 - "POST /sdapi/v1/txt2img HTTP/1.1" 500 Internal Server Error
Traceback (most recent call last):
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/streams/memory.py", line 94, in receive
return self.receive_nowait()
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/streams/memory.py", line 89, in receive_nowait
raise WouldBlock
anyio.WouldBlock
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 78, in call_next
message = await recv_stream.receive()
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/streams/memory.py", line 114, in receive
raise EndOfStream
anyio.EndOfStream
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/fish/stable-diffusion-webui/modules/api/api.py", line 144, in exception_handling
return await call_next(request)
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 84, in call_next
raise app_exc
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 70, in coro
await self.app(scope, receive_or_disconnect, send_no_error)
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 108, in __call__
response = await self.dispatch_func(request, call_next)
File "/root/fish/stable-diffusion-webui/modules/api/api.py", line 109, in log_and_time
res: Response = await call_next(req)
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 84, in call_next
raise app_exc
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 70, in coro
await self.app(scope, receive_or_disconnect, send_no_error)
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 24, in __call__
await responder(scope, receive, send)
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 44, in __call__
await self.app(scope, receive, self.send_with_gzip)
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
raise exc
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
await self.app(scope, receive, sender)
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
raise e
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
await self.app(scope, receive, send)
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__
await route.handle(scope, receive, send)
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/routing.py", line 66, in app
response = await func(request)
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/fastapi/routing.py", line 237, in app
raw_response = await run_endpoint_function(
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/fastapi/routing.py", line 165, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
return await future
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run
result = context.run(func, *args)
File "/root/fish/stable-diffusion-webui/modules/api/api.py", line 283, in text2imgapi
ui.create_ui()
File "/root/fish/stable-diffusion-webui/modules/ui.py", line 1051, in create_ui
ui_postprocessing.create_ui()
File "/root/fish/stable-diffusion-webui/modules/ui_postprocessing.py", line 25, in create_ui
script_inputs = scripts.scripts_postproc.setup_ui()
File "/root/fish/stable-diffusion-webui/modules/scripts_postprocessing.py", line 113, in setup_ui
self.create_script_ui(script, inputs)
File "/root/fish/stable-diffusion-webui/modules/scripts_postprocessing.py", line 84, in create_script_ui
for control in script.controls.values():
AttributeError: 'NoneType' object has no attribute 'values'
Additional information
other error print
calling /root/fish/stable-diffusion-webui/scripts/postprocessing_upscale.py/ui: AttributeError
Traceback (most recent call last):
File "/root/fish/stable-diffusion-webui/modules/scripts_postprocessing.py", line 53, in wrap_call
res = func(*args, **kwargs)
File "/root/fish/stable-diffusion-webui/scripts/postprocessing_upscale.py", line 42, in ui
upscaling_res_switch_btn.click(lambda w, h: (h, w), inputs=[upscaling_resize_w, upscaling_resize_h], outputs=[upscaling_resize_w, upscaling_resize_h], show_progress=False)
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/events.py", line 132, in __call__
dep, dep_index = self.trigger.set_event_trigger(
File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/blocks.py", line 221, in set_event_trigger
raise AttributeError(
AttributeError: click() and other events can only be called within a Blocks context.
Is there an existing issue for this?
What happened?
when CALL txt2img api, return 500 Internal Server Error : {'error': 'AttributeError', 'detail': '', 'body': '', 'errors': 'click() and other events can only be called within a Blocks context.'}.
restart program can temporarily resolve this problem.
Steps to reproduce the problem
possible occurrence when start program
What should have happened?
API return 200 and works fine
Commit where the problem happens
89f9faa
What Python version are you running on ?
Python 3.10.x
What platforms do you use to access the UI ?
Linux
What device are you running WebUI on?
No response
What browsers do you use to access the UI ?
No response
Command Line Arguments
List of extensions
No
Console logs
API error: POST: /sdapi/v1/txt2img {'error': 'AttributeError', 'detail': '', 'body': '', 'errors': 'click() and other events can only be called within a Blocks context.'} INFO: None:0 - "POST /sdapi/v1/txt2img HTTP/1.1" 500 Internal Server Error Traceback (most recent call last): File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/streams/memory.py", line 94, in receive return self.receive_nowait() File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/streams/memory.py", line 89, in receive_nowait raise WouldBlock anyio.WouldBlock During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 78, in call_next message = await recv_stream.receive() File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/streams/memory.py", line 114, in receive raise EndOfStream anyio.EndOfStream During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/root/fish/stable-diffusion-webui/modules/api/api.py", line 144, in exception_handling return await call_next(request) File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 84, in call_next raise app_exc File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 70, in coro await self.app(scope, receive_or_disconnect, send_no_error) File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 108, in __call__ response = await self.dispatch_func(request, call_next) File "/root/fish/stable-diffusion-webui/modules/api/api.py", line 109, in log_and_time res: Response = await call_next(req) File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 84, in call_next raise app_exc File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 70, in coro await self.app(scope, receive_or_disconnect, send_no_error) File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 24, in __call__ await responder(scope, receive, send) File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 44, in __call__ await self.app(scope, receive, self.send_with_gzip) File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__ raise exc File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__ await self.app(scope, receive, sender) File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__ raise e File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__ await self.app(scope, receive, send) File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__ await route.handle(scope, receive, send) File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle await self.app(scope, receive, send) File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/routing.py", line 66, in app response = await func(request) File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/fastapi/routing.py", line 237, in app raw_response = await run_endpoint_function( File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/fastapi/routing.py", line 165, in run_endpoint_function return await run_in_threadpool(dependant.call, **values) File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool return await anyio.to_thread.run_sync(func, *args) File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/to_thread.py", line 31, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread return await future File "/root/fish/stable-diffusion-webui/venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 867, in run result = context.run(func, *args) File "/root/fish/stable-diffusion-webui/modules/api/api.py", line 283, in text2imgapi ui.create_ui() File "/root/fish/stable-diffusion-webui/modules/ui.py", line 1051, in create_ui ui_postprocessing.create_ui() File "/root/fish/stable-diffusion-webui/modules/ui_postprocessing.py", line 25, in create_ui script_inputs = scripts.scripts_postproc.setup_ui() File "/root/fish/stable-diffusion-webui/modules/scripts_postprocessing.py", line 113, in setup_ui self.create_script_ui(script, inputs) File "/root/fish/stable-diffusion-webui/modules/scripts_postprocessing.py", line 84, in create_script_ui for control in script.controls.values(): AttributeError: 'NoneType' object has no attribute 'values'Additional information
other error print