Spaces:
Running
Running
amaye15
commited on
Commit
·
0a0fdaf
1
Parent(s):
fb0a3d8
Feat - Use GZip
Browse files
main.py
CHANGED
@@ -5,6 +5,7 @@ from fastapi import FastAPI, HTTPException, Request
|
|
5 |
from fastapi.responses import HTMLResponse, JSONResponse, RedirectResponse
|
6 |
from fastapi.staticfiles import StaticFiles
|
7 |
from fastapi.middleware.cors import CORSMiddleware
|
|
|
8 |
from fastapi.templating import Jinja2Templates
|
9 |
from fastapi.exceptions import RequestValidationError
|
10 |
from starlette.middleware.base import BaseHTTPMiddleware
|
@@ -363,6 +364,7 @@ app.add_middleware(
|
|
363 |
allow_methods=["*"], # Allows all methods
|
364 |
allow_headers=["*"], # Allows all headers
|
365 |
)
|
|
|
366 |
|
367 |
# API token security
|
368 |
security = HTTPBearer()
|
|
|
5 |
from fastapi.responses import HTMLResponse, JSONResponse, RedirectResponse
|
6 |
from fastapi.staticfiles import StaticFiles
|
7 |
from fastapi.middleware.cors import CORSMiddleware
|
8 |
+
from fastapi.middleware.gzip import GZipMiddleware
|
9 |
from fastapi.templating import Jinja2Templates
|
10 |
from fastapi.exceptions import RequestValidationError
|
11 |
from starlette.middleware.base import BaseHTTPMiddleware
|
|
|
364 |
allow_methods=["*"], # Allows all methods
|
365 |
allow_headers=["*"], # Allows all headers
|
366 |
)
|
367 |
+
app.add_middleware(GZipMiddleware, minimum_size=1000)
|
368 |
|
369 |
# API token security
|
370 |
security = HTTPBearer()
|