AttributeError: 'ray._raylet.ObjectRef' object has no attribute 'save'

I’m running inference on a stable diffusion model on aws inf2 instance using rayserve. I’m running into the below issue when I try to do image.save().
Any idea on how can I fix this issue?

File "/home/ray/anaconda3/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
412    await self.app(scope, receive, send)
413  File "/home/ray/anaconda3/lib/python3.10/site-packages/starlette/routing.py", line 754, in __call__
414    await self.middleware_stack(scope, receive, send)
415  File "/home/ray/anaconda3/lib/python3.10/site-packages/starlette/routing.py", line 774, in app
416    await route.handle(scope, receive, send)
417  File "/home/ray/anaconda3/lib/python3.10/site-packages/starlette/routing.py", line 296, in handle
418    await self.app(scope, receive, send)
419  File "/home/ray/anaconda3/lib/python3.10/site-packages/starlette/routing.py", line 75, in app
420    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
421  File "/home/ray/anaconda3/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
422    raise exc
423  File "/home/ray/anaconda3/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
424    await app(scope, receive, sender)
425  File "/home/ray/anaconda3/lib/python3.10/site-packages/starlette/routing.py", line 70, in app
426    response = await func(request)
427  File "/home/ray/anaconda3/lib/python3.10/site-packages/fastapi/routing.py", line 241, in app
428    raw_response = await run_endpoint_function(
429  File "/home/ray/anaconda3/lib/python3.10/site-packages/fastapi/routing.py", line 167, in run_endpoint_function
430    return await dependant.call(**values)
431  File "/serve_app/ray_serve_stablediffusion.py", line 34, in generate
432    image.save(file_stream, "PNG")
433AttributeError: 'ray._raylet.ObjectRef' object has no attribute 'save'

image must be awaited before it can be used. It’s still a Ray ObjectRef. Can you try adding the following line before saving the image:

image = await image