Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,14 @@
|
|
1 |
-
import
|
|
|
2 |
|
3 |
-
|
4 |
-
return " / ".join(list(text))
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
demo.launch()
|
|
|
1 |
+
from fastapi import FastAPI, Request
|
2 |
+
from fastapi.responses import JSONResponse
|
3 |
|
4 |
+
app = FastAPI()
|
|
|
5 |
|
6 |
+
@app.post("/run_predict")
|
7 |
+
async def run_predict(request: Request):
|
8 |
+
try:
|
9 |
+
body = await request.json()
|
10 |
+
sentences = body.get("data", [])
|
11 |
+
results = [" / ".join(list(s)) for s in sentences]
|
12 |
+
return JSONResponse(content={"data": results})
|
13 |
+
except Exception as e:
|
14 |
+
return JSONResponse(content={"error": str(e)}, status_code=500)
|
|