# Example script not working

**URL:** <https://discuss.ray.io/t/example-script-not-working/2406>\
**Category:** Ray Serve\
**Created:** [June 3, 2021, 5:45pm UTC](https://discuss.ray.io/t/example-script-not-working/2406 "2021-06-03T17:45:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oyin](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/oyin/32/1077_2.png) [@Oyin](https://discuss.ray.io/u/Oyin)\
**Post date:** [June 3, 2021, 5:45pm UTC](https://discuss.ray.io/t/example-script-not-working/2406/1 "2021-06-03T17:45:18Z")

</div>

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](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’

---

<div class="post-metadata">

**Author:** ![simon-mo](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/simon-mo/32/9_2.png) [@simon-mo](https://discuss.ray.io/u/simon-mo)\
**Post date:** [June 3, 2021, 7:26pm UTC](https://discuss.ray.io/t/example-script-not-working/2406/2 "2021-06-03T19:26:17Z")

</div>

Hi @Oyin, can you try the nightly release? [Installing Ray — Ray 3.0.0.dev0](https://docs.ray.io/en/master/installation.html#daily-releases-nightlies)

> 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](https://docs.google.com/document/d/1Tgm-bHz6au0B8F_Ps0SLPXh9oyw8pIaGWKWunnK-Kuw) for details on how to update your existing Serve application to use this new API and as always we welcome feedback on [Slack](https://docs.google.com/forms/u/1/d/e/1FAIpQLSfAcoiLCHOguOm8e7Jnn-JJdZaCxPGjgVCvFijHB5PLaQLeig/viewform?usp=send_form), [GitHub](https://github.com/ray-project/ray/issues), or the [Ray forum](http://discuss.ray.io/)!
