NUROISEA/anime-webui-colab

RuntimeError: Cannot add middleware after an application has started

bmaher2009 opened this issue · 1 comments

This share link expires in 72 hours. For free permanent hosting and GPU upgrades (NEW!), check out Spaces: https://huggingface.co/spaces
Traceback (most recent call last):
File "launch.py", line 327, in
start()
File "launch.py", line 320, in start
webui.webui()
File "/content/stable-diffusion-webui/webui.py", line 224, in webui
app.add_middleware(GZipMiddleware, minimum_size=1000)
File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 135, in add_middleware
raise RuntimeError("Cannot add middleware after an application has started")
RuntimeError: Cannot add middleware after an application has started
Killing tunnel 127.0.0.1:7860 <> https://731ed925-7ded-4a3e.gradio.live/

Related PR: AUTOMATIC1111/stable-diffusion-webui#7717

For the meantime add the following line before utility.has_run = True in the notebook:

!echo "fastapi==0.90.1" >> /content/stable-diffusion-webui/requirements_versions.txt

So it looks like similar to the following:

  !sed -i -e '''/    prepare_environment()/a\    os.system\(f\"""sed -i -e ''\"s/self.logvar\\[t\\]/self.logvar\\[t.item()\\]/g\"'' /content/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/models/diffusion/ddpm.py""")''' /content/stable-diffusion-webui/launch.py
  !sed -i -e '''/    prepare_environment()/a\    os.system\(f\"""sed -i -e ''\"s/dict()))$/dict())).cuda()/gm\"'' /content/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/util.py""")''' /content/stable-diffusion-webui/launch.py
  !echo "fastapi==0.90.1" >> /content/stable-diffusion-webui/requirements_versions.txt  
  utility.has_run = True 

Can't update atm since I'm at my phone lol, regardless thanks for reporting!