Application CLI

Manage applications from command line interface

Baseet.ai offers the Command Line Interface (CLI) tool to interfacing with applications on Baseet.ai. By the CLI you can login to your account, search applications, execute applications from your device.

Installation

You can download Baseet.ai CLI tool from Baseet.ai based on your OS:

  • Linux : from the terminal

  • Windows: from Windows PowerShell

All the following tutorial is based on Windows build. For Linux users only replace ./baseet.exe with ./baseet

Authentication

In order to use calls with the CLI, you will need to log in with your account credentials.

.\baseet.exe login --email example@gmail.com --password *****

a confirmation message will be shown: You are Logged in Successfully!

Usage

To explore the main commands Baseet CLI offer call baseet.exe, the following output will be shown.

your CLI tool directory> .\baseet.exe
NAME:
Baseet CLI - AI as a Service
USAGE:
baseet.exe [global options] command [command options] [
VERSION:
1.0.0
AUTHOR:
Baseet.ai <info@baseet.ai>
COMMANDS:
login
execute
get
search
help, h Shows a list of commands or help for one com
GLOBAL OPTIONS:
--help, -h show help (default: false)
--version, -v print the version (default: false)

So the main commands are: log in, execute, get, search, and help. Details of each command are described in this part:

Using search command you can search your applications and community applications with summary information of each app (id, name, description, and creation time). To show the available search options type .\baseet.exe search -h or .\baseet.exe search -help , the results are:

NAME:
baseet.exe search -
USAGE:
baseet.exe search [command options] [arguments...]
OPTIONS:
--name value
--public --public=true|false (default: false)
--sort value --sort=-created_at|created_at|name (default: "-created_at")
--tags value --tags=a,b,c
--limit value --limit=20 (default: 10)
--format value --format=json|table (default: table)
--output_path value
--help, -h show help (default: false)

Here are samples of running search command:

To show 10 default applications, run search command without any parameters as follows:

your CLI tool directory > .\baseet.exe search
*___________________*________________________________*________________________________*__________________________*
| ID | NAME | DESCRIPTION | CREATED AT |
*___________________*________________________________*________________________________*__________________________*
| GJswt5qJFm0JAzJze | test cli | no desc | 2020-03-01T11:36:47.823Z |
*___________________*________________________________*________________________________*__________________________*
| 352ciayZqRiXbgbwl | Twitter ShowCase - Phase 1 | NO Description | 2020-02-25T08:59:39.19Z |
*___________________*________________________________*________________________________*__________________________*
| FuGFnbcWhmSBvEnDW | myapp3 | NO Description | 2020-02-25T08:59:39.19Z |
*___________________*________________________________*________________________________*__________________________*
| A08AcB3CrKblDIgqb | Reviews Sentiment Analysis 2 | NO Description | 2020-02-25T08:59:39.19Z |
*___________________*________________________________*________________________________*__________________________*
| 0s2BXc77kgFonDsH9 | Sentiment Analysis - | Predict sentiment of the input | 2020-02-25T08:59:39.19Z |
| | Prediction | reviews using a pre-trained | |
| | | model | |
*___________________*________________________________*________________________________*__________________________*
| 9uUD7eH1dwu9heihS | Trading Bot | A trading bot that uses LSTM | 2020-02-25T08:59:39.19Z |
| | | to predict the price of crypto | |
| | | (WIP) | |
*___________________*________________________________*________________________________*__________________________*
| 45mW7SRcBgn0Npm4I | New Test App 03 | Add a short, one-sentence | 2020-02-25T08:59:39.19Z |
| | | description | |
*___________________*________________________________*________________________________*__________________________*
| oQTgqMVIzomVTbENJ | Fashion Classifier | Classifies products in | 2020-02-25T08:59:39.19Z |
| | | an image based on fashion | |
| | | products (Bag, Shoe, etc..) | |
*___________________*________________________________*________________________________*__________________________*
| X1TGLVeHdwMLFRIoK | myApp1 | NO Description | 2020-02-25T08:59:39.19Z |
*___________________*________________________________*________________________________*__________________________*
| ZpKJcuCGATSHpDBbE | Image classifier - original | NO Description | 2020-02-25T08:59:39.19Z |
*___________________*________________________________*________________________________*__________________________*

limit option:

You can change the number of shown apps to 20 for example by using:

your CLI tool directory> .\baseet.exe search --limit 20

name option:

To list apps contains a specific word use --name command, for example, to list all apps contains sentiment word in the app name, use the following command:

your CLI tool directory> .\baseet.exe search --name sentiment
*___________________*________________________________*________________________________*__________________________*
| ID | NAME | DESCRIPTION | CREATED AT |
*___________________*________________________________*________________________________*__________________________*
| A08AcB3CrKblDIgqb | Reviews Sentiment Analysis 2 | NO Description | 2020-02-25T08:59:39.19Z |
*___________________*________________________________*________________________________*__________________________*
| 0s2BXc77kgFonDsH9 | Sentiment Analysis - | Predict sentiment of the input | 2020-02-25T08:59:39.19Z |
| | Prediction | reviews using a pre-trained | |
| | | model | |
*___________________*________________________________*________________________________*__________________________*
| ThjqdeXLGaeJQTqMy | Reviews Sentiment Analysis ML | Train sentiment analysis model | 2020-02-25T08:59:39.19Z |
| | | on your custom product reviews | |
| | | dataset using machine learning | |
| | | techniques. | |
*___________________*________________________________*________________________________*__________________________*
| nSrVwE98fABc2sIkv | Forked: Sentiment Analysis - | Predict sentiment of the input | 2020-02-23T17:43:02.56Z |
| | Prediction | reviews using a pre-trained | |
| | | model | |
*___________________*________________________________*________________________________*__________________________*
| oLI1V33aJv1MAYurq | Reviews Sentiment Analysis DL | Train sentiment analysis model | 2020-01-26T12:20:39.679Z |
| | | on your custom product reviews | |
| | | dataset using deep learning | |
| | | techniques. | |
*___________________*________________________________*________________________________*__________________________*

public option:

To search all applications use --public=true which is the default option and to search your applications only use --public=false

sort option:

If you want to show apps based on the created time you can use sort command with two options: created_at to show old created apps firstly and -created_at to show recently created apps firstly.

your CLI tool directory> .\baseet.exe search --sort created_at
your CLI tool directory> .\baseet.exe search --sort -created_at

tags option:

To list apps contains specific tags use --tags command, for example, to list all apps contains insight tag, use the following command:

your CLI tool directory> .\baseet.exe search --tags insight

You can search applications contains multiple tags using the same command as following:

your CLI tool directory> .\baseet.exe search --tags "insight,deep learning"

format option & output_path option:

The default option to show the result of search command is a table as shown previously, but there is another option to show apps which is JSON format where the output will be store in a JSON file in the current directory with a default name or you can specify the output path and output file name using output-path command.

your CLI tool directory> .\baseet.exe search --limit 5 --format table
your CLI tool directory> .\baseet.exe search --limit 5 --format json
your CLI tool directory> .\baseet.exe search --limit 5 --format json --output_path your_output_directory/output_file_name

The following shows a sample of JSON file output output_file_name.json:

Get

To work on a specific app you can use get command to retrieve the app, the main options of get command are listed below using the help option:

your CLI tool directory> ./baseet.exe get -h
NAME:
baseet.exe get -
USAGE:
baseet.exe get [command options] [arguments...]
OPTIONS:
--id value
--format value --format=json|table (default: table)
--output_path value
--help, -h show help (default: false)

Id option:

To explore the required inputs of the app with its details use get --id app_id option:

your CLI tool directory> ./baseet.exe get --id 5w0ipdsPubYzaxBsL
Node Name: Extract Tweets
Node ID: 8
*____________*____________*____________*___________________________*__________*
| NAME | FIELD TYPE | INPUT TYPE | RULES | REQUIRED |
*____________*____________*____________*___________________________*__________*
| end_date | str | - | default="2020-01-12" | 1 |
*____________*____________*____________*___________________________*__________*
| keyword | str | text | default="#startrekpicard" | 1 |
*____________*____________*____________*___________________________*__________*
| limit | int | - | default="1000" | 1 |
*____________*____________*____________*___________________________*__________*
| start_date | str | - | default="2020-01-07" | 1 |
*____________*____________*____________*___________________________*__________*

Format option & output_path option:

The default option to show the result of get command is a table as shown previously, but there is another option to show apps which is JSON format where the output will be store in a JSON file in the current directory or you can specify the output path using output-path command.

your CLI tool directory> ./baseet.exe get --id 5w0ipdsPubYzaxBsL --format=json
output file input_details_1583313966.json
output file input_template_1583313966.json
your CLI tool directory> ./baseet.exe get --id 5w0ipdsPubYzaxBsL --format=json --output_path your_output_directory
your_output_directory/output file input_details_1583313966.json
your_output_directory/output file input_template_1583313966.json

The results of running the get command with JSON option are two JSON files in your_output_directory:

  • Template file: contains summary information of the nodes with required input fields from the user associated with their default values.

  • Details file: contains detailed information of the nodes with required input fields from the user.

Execute

You can execute an application from CLI using the execute command, the following are the main options of this command:

your CLI tool directory> ./baseet.exe execute -h
NAME:
baseet.exe execute -
USAGE:
baseet.exe execute [command options] [arguments...]
OPTIONS:
--id value
--input value
--output_path value
--help, -h show help (default: false)

To execute an app we must feed it with the required input values, for that, firstly we must run the get command with JSON format option to get the template file and edit its input values, then run the execute command with the input file directory and output file directory.

Let's execute Twitter Keyword Insight App with id: 5w0ipdsPubYzaxBsL and store input files and output file in the same current directory:

your CLI tool directory> ./baseet.exe get --id 5w0ipdsPubYzaxBsL --format=json
output file input_details_1583323907.json
output file input_template_1583323907.json

The previous two JSON files will be stored in your directory, let's change the input values from the template file, for example, change the limit to be 500 and save the file:

Execute the app with feeding it with the edited template input file and store the output in myoutputfile.json in the current directory:

your CLI tool directory> /baseet.exe execute --id 5w0ipdsPubYzaxBsL --input input_template_1583323907.json --output_path myoutputfile.json

The progress of execution will be shown on the shell:

...
progress 85%
progress 85%
progress 85%
progress 85%
progress 85%
progress 85%
progress 100%
App Execution Succeeded
output file myoutputfile.json

Open the output file myoutputfile.json. It contains the output of each node, this app has 4 output nodes:

Each output node in this app is an image, to view the image click on the link inside the node block, for example, Frequent Hashtags node output is:

If the input is an image, you can copy its full directory to the app template file as following:

"image": "file: your_img_directory_with img_extension"