Spaces:
Sleeping
Sleeping
amaye15
commited on
Commit
·
b8b8738
1
Parent(s):
768cc49
Feat - Add GZip Compression
Browse files- src/main.py +3 -0
src/main.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import os
|
| 2 |
from fastapi import FastAPI, Depends, HTTPException
|
| 3 |
from fastapi.responses import JSONResponse, RedirectResponse
|
|
|
|
| 4 |
from pydantic import BaseModel
|
| 5 |
from typing import List, Dict
|
| 6 |
from src.api.models.embedding_models import (
|
|
@@ -39,6 +40,8 @@ app = FastAPI(
|
|
| 39 |
version="1.0.0",
|
| 40 |
)
|
| 41 |
|
|
|
|
|
|
|
| 42 |
|
| 43 |
# Root endpoint redirects to /docs
|
| 44 |
@app.get("/")
|
|
|
|
| 1 |
import os
|
| 2 |
from fastapi import FastAPI, Depends, HTTPException
|
| 3 |
from fastapi.responses import JSONResponse, RedirectResponse
|
| 4 |
+
from fastapi.middleware.gzip import GZipMiddleware
|
| 5 |
from pydantic import BaseModel
|
| 6 |
from typing import List, Dict
|
| 7 |
from src.api.models.embedding_models import (
|
|
|
|
| 40 |
version="1.0.0",
|
| 41 |
)
|
| 42 |
|
| 43 |
+
app.add_middleware(GZipMiddleware, minimum_size=1000)
|
| 44 |
+
|
| 45 |
|
| 46 |
# Root endpoint redirects to /docs
|
| 47 |
@app.get("/")
|