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

RuntimeError: Cannot add middleware after an application has started #1

Closed
bmaher2009 opened this issue Feb 10, 2023 · 1 comment
Closed

Comments

@bmaher2009
Copy link

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/

@NUROISEA
Copy link
Owner

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!

@NUROISEA NUROISEA changed the title Link kills itself RuntimeError: Cannot add middleware after an application has started Feb 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants