Send and read file in RayServe

Hello, I am trying to use my existing fastapi code, but scale it with RayServe. This is the code snippet:

from fastapi import UploadFile, FastAPI
from ray import serve
app = FastAPI()

@serve.deployment() 
@serve.ingress(app)
class MyFastAPIDeployment:
    @app.post("/segment_text")
    async def segment_text(text: UploadFile):
        text = await text.read()

This code in FastApi worked fine, but with RayServe I am getting an error 'MyFastAPIDeployment' object has no attribute 'read'
Can you please advice me on how to send files and read them?

Mistake found - forgot about self. Should be

from fastapi import UploadFile, FastAPI
from ray import serve
app = FastAPI()

@serve.deployment() 
@serve.ingress(app)
class MyFastAPIDeployment:
    @app.post("/segment_text")
    async def segment_text(self, text: UploadFile):
        text = await text.read()

Thanks for following up with your solution @bocharova.maiia! You can also post questions about Ray Serve in the Ray Serve channel where more Ray Serve users can help out.