from fastapi import FastAPI, Request from fastapi.responses import JSONResponse app = FastAPI() @app.post("/run_predict") async def run_predict(request: Request): try: body = await request.json() sentences = body.get("data", []) results = [" / ".join(list(s)) for s in sentences] return JSONResponse(content={"data": results}) except Exception as e: return JSONResponse(content={"error": str(e)}, status_code=500)