Update main.py
Browse files
main.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
from llama_cpp.server.app import create_app, Settings
|
| 2 |
from fastapi.responses import HTMLResponse
|
| 3 |
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
| 4 |
import os
|
| 5 |
|
| 6 |
app = create_app(
|
|
@@ -18,18 +19,11 @@ app.add_middleware(
|
|
| 18 |
allow_methods=["*"],
|
| 19 |
allow_headers=["*"],
|
| 20 |
)
|
| 21 |
-
|
| 22 |
-
@app.get(
|
| 23 |
-
def
|
| 24 |
-
|
| 25 |
-
<html>
|
| 26 |
-
<body>
|
| 27 |
-
<h1>Test</h1>
|
| 28 |
-
</body>
|
| 29 |
-
</html>
|
| 30 |
-
"""
|
| 31 |
-
return HTMLResponse(content=html_content)
|
| 32 |
|
| 33 |
if __name__ == "__main__":
|
| 34 |
import uvicorn
|
| 35 |
-
uvicorn.run(app, host="
|
|
|
|
| 1 |
from llama_cpp.server.app import create_app, Settings
|
| 2 |
from fastapi.responses import HTMLResponse
|
| 3 |
from fastapi.middleware.cors import CORSMiddleware
|
| 4 |
+
from fastapi.responses import RedirectResponse
|
| 5 |
import os
|
| 6 |
|
| 7 |
app = create_app(
|
|
|
|
| 19 |
allow_methods=["*"],
|
| 20 |
allow_headers=["*"],
|
| 21 |
)
|
| 22 |
+
|
| 23 |
+
@app.get("/")
|
| 24 |
+
async def redirect_root_to_docs():
|
| 25 |
+
return RedirectResponse("/docs")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
if __name__ == "__main__":
|
| 28 |
import uvicorn
|
| 29 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|