Skip to content

Commit

Permalink
docs: update the examples to match the new implementation (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
hussein-awala authored Feb 23, 2024
1 parent 98a352a commit b973c29
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class MyAsyncBatcher(AsyncBatcher):
print(batch)

# Create a new instance of the `MyAsyncBatcher` class
async_batcher = MyAsyncBatcher(batch_size=20)
async_batcher = MyAsyncBatcher(max_batch_size=20)
async_batcher.start()
```

Expand Down
5 changes: 3 additions & 2 deletions examples/keras_with_grpc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PredictorGRPC(predictor_pb2_grpc.KerasPredictorServicer):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
model = tf.keras.models.load_model("../diabetes_tf_model.h5")
self.batcher = MlBatcher(model=model, batch_size=200, sleep_time=0.0001)
self.batcher = MlBatcher(model=model, max_batch_size=200, max_queue_time=0.01)

async def Predict(
self,
Expand Down Expand Up @@ -62,5 +62,6 @@ async def server_graceful_shutdown():
try:
loop.run_until_complete(serve())
finally:
loop.run_until_complete(*_cleanup_coroutines)
if _cleanup_coroutines:
loop.run_until_complete(*_cleanup_coroutines)
loop.close()

0 comments on commit b973c29

Please sign in to comment.