Install and run quickstart

Follow this quickstart to achieve the following operations:

Prerequisites

Build

Clone the code from GitHub then use an IDE or the command line to continue.

Build with an IDE

Import the code as a Java project. IntelliJ is recommended.

RAID uses Lombok to reduce boilerplate code. Ensure that the IDE has a Lombok plugin and that annotation processing is enabled.

Build with the command line

Go into the project root folder and build an executable JAR as follows:

$ ./gradlew bootJar

Run

Ensure RAID is built then run it with an IDE or the command line.

Run with an IDE

Open AIDemoApplication.java and run the main method using the IDE Play button.

Run with the command line

Go into the project root folder and run the executable JAR as follows:

$ java -jar build/libs/demo-0.0.1-SNAPSHOT.jar

Use the RESTful API

Access the API on the root context path /:

http://localhost:8080/

The easiest way to call the API operations is to use the Swagger UI. Alternatively, use Postman or curl and ensure that the Content-Type header is set to application/json.

Send a chat message

Send the following chat request:

POST /zoo-chatbot/chat
{
  "message": "any giraffes?"
}

The response is as follows:

Data is truncated for readability.

Response
{
  "category": "animal-list",
  "reply": "The zoo has 10 giraffes, 3 elephants, 2 lions and 12 penguins",
  "probabilities": [
    {
      "category": "animal-list",
      "probability": 0.6893424773
    },
    {
      "category": "directions",
      "probability": 0.0776643807
    },
    {
      "category": "opening-times",
      "probability": 0.0776643807
    }
  ]
}

Send an image of a handwritten number

Send the following image recognition request:

POST /handwriting-recogniser/classify-handwritten-number
{
  "fileName": "0.png"
}

The response is as follows:

Data is truncated for readability.

Response
{
  "handwrittenNumber": "0",
  "probabilities": [
    {
      "handwrittenNumber": "0",
      "probability": 0.9999525547
    },
    {
      "handwrittenNumber": "2",
      "probability": 0.0000418071
    },
    {
      "handwrittenNumber": "6",
      "probability": 0.0000029869
    }
  ]
}

Learn more