Commit
·
575e725
1
Parent(s):
6c3814d
feat: added GZipMiddleware for gzip response
Browse files
main.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
from llama_cpp.server.app import create_app, Settings
|
| 2 |
from fastapi.responses import HTMLResponse
|
|
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
app = create_app(
|
|
@@ -10,6 +11,8 @@ app = create_app(
|
|
| 10 |
)
|
| 11 |
)
|
| 12 |
|
|
|
|
|
|
|
| 13 |
# Read the content of index.html once and store it in memory
|
| 14 |
with open("index.html", "r") as f:
|
| 15 |
content = f.read()
|
|
|
|
| 1 |
from llama_cpp.server.app import create_app, Settings
|
| 2 |
from fastapi.responses import HTMLResponse
|
| 3 |
+
from fastapi.middleware.gzip import GZipMiddleware
|
| 4 |
import os
|
| 5 |
|
| 6 |
app = create_app(
|
|
|
|
| 11 |
)
|
| 12 |
)
|
| 13 |
|
| 14 |
+
app.add_middleware(GZipMiddleware, minimum_size=1000)
|
| 15 |
+
|
| 16 |
# Read the content of index.html once and store it in memory
|
| 17 |
with open("index.html", "r") as f:
|
| 18 |
content = f.read()
|