Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
from fastapi import FastAPI, Request
|
2 |
from fastapi.responses import HTMLResponse, StreamingResponse
|
3 |
-
from fastapi.templating import Jinja2Templates
|
4 |
from fastapi.staticfiles import StaticFiles
|
5 |
from pmbl import PMBL
|
6 |
import os
|
@@ -10,8 +9,7 @@ pmbl = PMBL("./PMB-7b.Q6_K.gguf") # Replace with the path to your model
|
|
10 |
|
11 |
app.mount("/", StaticFiles(directory="static"), name="static")
|
12 |
|
13 |
-
|
14 |
-
|
15 |
@app.post("/chat")
|
16 |
async def chat(request: Request):
|
17 |
try:
|
@@ -38,9 +36,3 @@ async def sleep():
|
|
38 |
print(f"[SYSTEM] Error: {str(e)}")
|
39 |
return {"error": str(e)}
|
40 |
|
41 |
-
if __name__ == "__main__":
|
42 |
-
import uvicorn
|
43 |
-
import asyncio
|
44 |
-
|
45 |
-
loop = asyncio.get_event_loop()
|
46 |
-
loop.run_until_complete(uvicorn.run(app, host="0.0.0.0", port=int(os.environ.get("PORT", 7860))))
|
|
|
1 |
from fastapi import FastAPI, Request
|
2 |
from fastapi.responses import HTMLResponse, StreamingResponse
|
|
|
3 |
from fastapi.staticfiles import StaticFiles
|
4 |
from pmbl import PMBL
|
5 |
import os
|
|
|
9 |
|
10 |
app.mount("/", StaticFiles(directory="static"), name="static")
|
11 |
|
12 |
+
=
|
|
|
13 |
@app.post("/chat")
|
14 |
async def chat(request: Request):
|
15 |
try:
|
|
|
36 |
print(f"[SYSTEM] Error: {str(e)}")
|
37 |
return {"error": str(e)}
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|