Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
from fastapi import FastAPI
|
|
|
2 |
from pydantic import BaseModel
|
3 |
from transformers import pipeline
|
4 |
import uvicorn
|
@@ -18,5 +19,6 @@ async def classify_text(text):
|
|
18 |
|
19 |
@app.post("/classify/")
|
20 |
async def classify(payload: Payload):
|
21 |
-
|
|
|
22 |
|
|
|
1 |
from fastapi import FastAPI
|
2 |
+
from fastapi.responses import JSONResponse
|
3 |
from pydantic import BaseModel
|
4 |
from transformers import pipeline
|
5 |
import uvicorn
|
|
|
19 |
|
20 |
@app.post("/classify/")
|
21 |
async def classify(payload: Payload):
|
22 |
+
result = await classify_text(payload.text)
|
23 |
+
return JSONResponse({"data": result})
|
24 |
|