Skip to content

Commit 529da95

Browse files
committed
Made the readme richer
1 parent 23ced88 commit 529da95

1 file changed

Lines changed: 28 additions & 5 deletions

File tree

README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Isquare client for Python
22

3-
This repository contains the client for [isquare](isquare.ai). It is available under the form of python classes, as well as a command-line-interface.
3+
This repository contains the official python client for [ISquare](isquare.ai). It is available under the form of python classes which are ready to use in your code, as well as a command-line-interface. We currently support inference with image, text & json files, as well as any numpy array or python dictionnary or string, both for input and output.
4+
5+
The complete documentation for ISquare can be found [here](docs.isquare.ai)
46

57
## Installation
68

@@ -16,27 +18,30 @@ pip install --editable .
1618

1719
### Additional requirements
1820

19-
To be able to test your models, you need the following packages:
21+
To be able to test your model builds, you need the following packages:
2022
Docker >= 19.03.13
2123

2224
_Note_: If you only need the client for inference, this is not required.
2325

2426
## Usage
27+
The client can be used to verify your model build (e.g. checking if they will properly run on [ISquare](isquare.ai)) and to perform inference calls to your deployed models. To use this client for inference, you need to have a model up and running on [ISquare](isquare.ai).
2528

2629
Commands and their usage are described [here](docs/commands.md).
2730

28-
Guidelines on the code adaptation required to deploy a model on isquare.ai can be found [here](docs/isquare_tutorial.md)
31+
End-to-end guidelines on the code adaptation required to deploy a model on isquare.ai can be found [here](docs/isquare_tutorial.md)
2932

3033
## Examples
3134

32-
- Build your i2 compatible docker image:
35+
### Command line interface
3336

37+
#### Test if your model repository is Isquare-compatible
38+
To verify if your code will run smoothly on [ISquare](isquare.ai), you can perform a local build & unit test. This will build a container image with all your specific dependencies and perform an inference test. We've included an example of a simple computer vision model which returns the mirrored image it is given, and it can be tested by running:
3439

3540
```bash
3641
i2 build examples/tasks/mirror.py
3742
```
43+
When you deploy a model with [ISquare](isquare.ai), you will be provided a url for the model, and requested to create access keys. Using a valid url & access keys (the one displayed are an example), you can perform an inference with an Image model (e.g. the Mirror) and a `.png` image by running:
3844

39-
Simple inference:
4045

4146
```bash
4247
i2 infer \
@@ -46,4 +51,22 @@ i2 infer \
4651
```
4752
Other examples can be found [here](docs/getting_started.md).
4853

54+
### Using a model inside your python code
55+
As you probably want to automate your model calls by integrating them directly into your code, we've provided you with several python classes you can directly use in your code. The main class to use for that is the `I2Client` class. A simple inference can be performed as follows:
56+
57+
```python
58+
from i2_client import I2Client
59+
import cv2
60+
61+
# You need your url, access key and an image
62+
url = "wss://archipel-beta1.isquare.ai/43465956-8d6f-492f-ad45-91da69da44d0"
63+
access_key = "472f9457-072c-4a1a-800b-75ecdd6041e1"
64+
img = cv2.imread("test.jpg")
65+
66+
# Initialize the client & perform inference
67+
inference_client = I2Client(url,access_key)
68+
success, output = i2_client.inference(img)[0]
69+
```
70+
71+
A more complex example, showing how to stream a camera to your model, can be found [here](examples/webcam_stream.py)
4972

0 commit comments

Comments
 (0)