Example script not working

import requests

import ray
from ray import serve

serve.start()

@serve.deployment
class Counter:
def init(self):
self.count = 0

def __call__(self, *args):
    self.count += 1
    return {"count": self.count}

Deploy our class.

Counter.deploy()

Query our endpoint in two different ways: from HTTP and from Python.

assert requests.get(“http://127.0.0.1:8000/Counter”).json() == {“count”: 1}
assert ray.get(Counter.get_handle().remote()) == {“count”: 2}

error: AttributeError: ‘function’ object has no attribute ‘deploy’

Hi @Oyin, can you try the nightly release? Installing Ray — Ray 3.0.0.dev0

Ray Serve is changing fast! You’re probably running the latest pip release and not the nightly build, so please ensure you’re viewing the correct version of this documentation.

As of Ray 1.4, Serve has a new API centered around the concept of “Deployments.” Deployments offer a more streamlined API and can be declaratively updated, which should improve both development and production workflows. The existing APIs have not changed from Ray 1.4 and will continue to work until Ray 1.5, at which point they will be removed (see the package reference if you’re not sure about a specific API). Please see the migration guide for details on how to update your existing Serve application to use this new API and as always we welcome feedback on Slack, GitHub, or the Ray forum!