mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(api): add gzip middleware
On our local installs this will be a very minor change. For those running on remote servers, load times should be slightly improved. It's a small change but I think correct.
This commit is contained in:
parent
ef14ba1713
commit
e4c45012f4
@ -17,6 +17,7 @@ if True: # hack to make flake8 happy with imports coming after setting up the c
|
|||||||
import uvicorn
|
import uvicorn
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
from fastapi.middleware.gzip import GZipMiddleware
|
||||||
from fastapi.openapi.docs import get_redoc_html, get_swagger_ui_html
|
from fastapi.openapi.docs import get_redoc_html, get_swagger_ui_html
|
||||||
from fastapi.openapi.utils import get_openapi
|
from fastapi.openapi.utils import get_openapi
|
||||||
from fastapi.staticfiles import StaticFiles
|
from fastapi.staticfiles import StaticFiles
|
||||||
@ -72,6 +73,8 @@ app.add_middleware(
|
|||||||
allow_headers=app_config.allow_headers,
|
allow_headers=app_config.allow_headers,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
app.add_middleware(GZipMiddleware, minimum_size=1000)
|
||||||
|
|
||||||
|
|
||||||
# Add startup event to load dependencies
|
# Add startup event to load dependencies
|
||||||
@app.on_event("startup")
|
@app.on_event("startup")
|
||||||
|
Loading…
Reference in New Issue
Block a user