From f3e3e9f897cff50a5cfa2e4ccd60bb1f876e1f35 Mon Sep 17 00:00:00 2001 From: Jeremy Metz Date: Tue, 24 Oct 2023 20:16:43 +0200 Subject: [PATCH 1/3] Minor edit, ghfmd warnings etc added --- docs/api.md | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/docs/api.md b/docs/api.md index 720c72b..11441ce 100644 --- a/docs/api.md +++ b/docs/api.md @@ -2,18 +2,22 @@ Under the hood, BioEngine uses [Hypha](https://ha.amun.ai/) to orchestrate the services provided in the containers. We uses the `imjoy-rpc` client to communicate to the Hypha server for model execution. -We provide a public free server for the BioEngine available at https://ai.imjoy.io. +We provide a free public server for the BioEngine available at https://ai.imjoy.io. -**NOTE: This server is meant for testing and evaluation purposes, please use it only to process small amount of data, to avoid overloading our server!** +>[!IMPORTANT] +> This server is meant for testing and evaluation purposes. +> Please only use it to process small amounts of data to avoid overloading our server! -The following documentation uses `https://ai.imjoy.io` as the server_url, it can be changed to switch to different server. +The following documentation uses `https://ai.imjoy.io` as the server_url - it can be changed to use to different server if desired. -**If you are interested in setting up your own BioEngine server, please check our preliminary repo for run BioEngine locally (tested on a Macbook pro): https://github.com/oeway/bioengine.WARNINIG: the on-premise deployment is under development, it's not completely ready yet.** +If you are interested in setting up your own BioEngine server, please check our _preliminary repo_ for run BioEngine locally (tested on a Macbook pro): https://github.com/oeway/bioengine. +>[!WARNING] +> The on-premise deployment is under development, it's not completely ready yet. -## Use the BioEngine in Python +## Using BioEngine in Python -First, you need to install the `imjoy-rpc` library: +First install the `imjoy-rpc` library: ```bash pip install imjoy-rpc @@ -25,7 +29,7 @@ Similarily, you can also use the `connect_to_server_sync` function to connect to -#### ** Asynchronous Client ** +#### Asynchronous Client ```python import asyncio @@ -57,7 +61,7 @@ if __name__ == "__main__": asyncio.run(main()) ``` -#### ** Synchronous Client ** +#### Synchronous Client ```python import asyncio @@ -91,10 +95,13 @@ if __name__ == "__main__": -**NOTE: In Python, the recommended way to interact with the server to use asynchronous functions with `asyncio`. However, if you need to use synchronous functions, you can use `from imjoy_rpc.hypha.sync import login, connect_to_server` (available since `imjoy-rpc>=0.5.25.post0`) instead. The have the exact same arguments as the asynchronous versions. For more information, see [Synchronous Wrapper](/imjoy-rpc?id=synchronous-wrapper)** +> [!NOTE] +> In Python, the recommended way to interact with the server to use asynchronous functions with `asyncio`. However, if you need to use synchronous functions, +> you can use `from imjoy_rpc.hypha.sync import login, connect_to_server` (available since `imjoy-rpc>=0.5.25.post0`) instead. +> The have the exact same arguments as the asynchronous versions. For more information, see [Synchronous Wrapper](/imjoy-rpc?id=synchronous-wrapper) - -**Tip: For QT-based applications, e.g. napari, imswitch, should use the synchronous api.** +> 💡 Tip
+> For QT-based applications, e.g. napari, imswitch, use the synchronous api. ## Using the BioEingine in JavaScript From 452916006a8b60697f66431db017aef34b098815 Mon Sep 17 00:00:00 2001 From: Jeremy Metz Date: Tue, 24 Oct 2023 20:24:21 +0200 Subject: [PATCH 2/3] Removed asyncio in sync example --- docs/api.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/api.md b/docs/api.md index 11441ce..96a52bf 100644 --- a/docs/api.md +++ b/docs/api.md @@ -64,7 +64,6 @@ if __name__ == "__main__": #### Synchronous Client ```python -import asyncio import numpy as np from imjoy_rpc.hypha.sync import connect_to_server @@ -90,7 +89,7 @@ def main(): return mask if __name__ == "__main__": - asyncio.run(main()) + main() ``` From 0b774b433eab2019e295969d7e92decfe496334e Mon Sep 17 00:00:00 2001 From: Wei Ouyang Date: Wed, 25 Oct 2023 11:01:42 +0200 Subject: [PATCH 3/3] Update api.md --- docs/api.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/api.md b/docs/api.md index 96a52bf..b374dca 100644 --- a/docs/api.md +++ b/docs/api.md @@ -29,7 +29,7 @@ Similarily, you can also use the `connect_to_server_sync` function to connect to -#### Asynchronous Client +#### **Asynchronous Client** ```python import asyncio @@ -61,7 +61,7 @@ if __name__ == "__main__": asyncio.run(main()) ``` -#### Synchronous Client +#### **Synchronous Client** ```python import numpy as np @@ -97,7 +97,7 @@ if __name__ == "__main__": > [!NOTE] > In Python, the recommended way to interact with the server to use asynchronous functions with `asyncio`. However, if you need to use synchronous functions, > you can use `from imjoy_rpc.hypha.sync import login, connect_to_server` (available since `imjoy-rpc>=0.5.25.post0`) instead. -> The have the exact same arguments as the asynchronous versions. For more information, see [Synchronous Wrapper](/imjoy-rpc?id=synchronous-wrapper) +> They have the exact same arguments as the asynchronous versions. For more information, see [Synchronous Wrapper](/imjoy-rpc?id=synchronous-wrapper) > 💡 Tip
> For QT-based applications, e.g. napari, imswitch, use the synchronous api.