Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ from fastapi.responses import JSONResponse
|
|
| 3 |
from pydantic import BaseModel
|
| 4 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 5 |
import torch
|
|
|
|
| 6 |
|
| 7 |
app = FastAPI()
|
| 8 |
|
|
@@ -50,4 +51,8 @@ async def receive(data: Message):
|
|
| 50 |
return JSONResponse({"reply": reply})
|
| 51 |
|
| 52 |
except Exception as e:
|
| 53 |
-
return JSONResponse({"error": str(e)})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
from pydantic import BaseModel
|
| 4 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 5 |
import torch
|
| 6 |
+
import uvicorn
|
| 7 |
|
| 8 |
app = FastAPI()
|
| 9 |
|
|
|
|
| 51 |
return JSONResponse({"reply": reply})
|
| 52 |
|
| 53 |
except Exception as e:
|
| 54 |
+
return JSONResponse({"error": str(e)})
|
| 55 |
+
|
| 56 |
+
# 👇 ВАЖНЫЙ БЛОК
|
| 57 |
+
if __name__ == "__main__":
|
| 58 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|