You can use the background task in the FastApi and return an job_id for the long processing task with 202 status code, for more information you can read this link.
Also you can write another endpoint in terms of returning job status and also its result. Also it depends on the your code design and also your architecture.