Export Plugins
With the Export custom plugin, you can add your own export format to Ango Hub with only a few clicks.
The Export custom plugin provides a way for you to obtain the normal Ango JSON Export, manipulate it from within a Python script, and present its manipulated version to users for download.
Creating an Export Plugin
Following the steps outlined in this section, create a new plugin from the UI, choosing "Export" as the plugin type.
Then, create and run a Python script using the ExportPlugin
class you can find in our imerit-ango
Python package under imerit_ango.plugins
.
In this script, you will get the 'regular' Ango export as input, and you will need to provide a .zip file as well as its name as output. An example is provided below.
You will need to add the imerit-ango
package to your Python environment by running
Here is the class's documentation, and an example:
ExportPlugin
Parameters:
id: str
The plugin's ID. You may obtain this ID from the plugin's information box in the Development section of the Plugin page.
secret: str
The plugin's secret. You can think of this as a private key you'll need to be able to connect your script to the plugin. You may obtain this secret from the plugin's information box in the Development section of the Plugin page.
callback: Callable[[str, dict], Tuple[str, BytesIO]]
The callback function. This function will be run whenever a user asks for the export using this plugin. More on the callback function below.
host: str, default="https://api.ango.ai"
You do not need to change the host unless you are creating plugins in environments other than our main Cloud instance at hub.ango.ai.
Callback Function
Parameters:
**data: dict
projectId: str
The ID of the project for which the export was wanted.
jsonExport: dict
The normal JSON export in Ango Hub Annotation Format. This is the export you would get if you manually requested the export in the "JSON" format.
logger: PluginLogger
[TODO]
apiKey: str
The API key of the user running the plugin.
orgId: str
The organization ID of the organization where the plugin is run.
runBy: str
User ID of the user running the plugin.
session: str
ID of the session opened when the plugin is run.
configJSON: str
The config JSON your users will pass to you through the Config JSON text field when running the plugin. Warning: the JSON will be passed as a string so you will have to destringify it. Example code to obtain the original JSON as a Python object named config:
Returns:
export_response_obj =
ExportResponse(file=zip_data, file_name=zip_file_name, storage_id="", bucket="")
zip_file_name: str
When closing your callback, you'll need to return the name of the export .zip file as a string here.
zip_data: BytesIO
The final .zip you will provide users with, containing the export.
Sample Python Script
Find sample code for an Export plugin at:
For this example, we use the following default Config JSON:
Getting an Export using the Plugin
Your Python script needs to be running for users to be able to download exports using your format.
Navigate to the project you'd like to get the export of. From the Settings tab, enter the Plugins section. Click Open on the Export plugin of interest.
From the dialog that pops up, click on Run. You will get a notification when your export is ready.
Last updated