This is a demo showing how to use DeepStack AI Server, from Delphi.
Inorder for this demo to work it's a prerequisite that you have downloaded, installed and started DeepStack AI Server.
DeepStack is an Open-Source AI API engine that serves pre-built models and custom models on multiple edge devices locally or on your private cloud. Click here to download your own copy.
For more information read about the project please goto their home page.
I got the inspiration for this watching Alister Christie video about it. You can watch the video by clicking on the image below
While Alister Christie was hand parsing the JSON result I'm using my own tool Delphi-JsonToDelphiClass for autogenerating the code So instead of witeteing code like this:
var j := TJsonObject.ParseJsonValue(Response.ContentAsString);
var s := j.FindValue('Success');
if s.AsType<string> = 'false' then
begin
---
end;
My tool generates a simple class taking care of all the JSON stuff
TObjectDetectionResult = class(TJsonDTO)
---
published
property Duration: Integer read FDuration write FDuration;
property Predictions: TObjectList<TPredictions> read GetPredictions;
property Success: Boolean read FSuccess write FSuccess;
public
---
end;
And the use of it is even more simple:
var detectionResult := TObjectDetectionResult.Create;
detectionResult.AsJSON := Response.ContentAsString;
if detectionResult.Success then
begin
---
end;
Besides from this I've done some cleanup of the code.
It's all incluuded in this repo.
The tool Delphi-JsonToDelphiClass is of cause also to be found here on Github. An of cause it's free and open source.