Simple CSharp Client Library for Deep AI's APIs
Get this package from NuGet: https://www.nuget.org/packages/DeepAI.Client/
Or clone and build this repository with Visual Studio 2013 or later.
(Update AssemblyInfo.cs bumping the version number) (Switch to the DeepAI solution before build) (Build) cd '/c/users/kevin/documents/visual studio 2013/projects/deepai.client/deepai.client/'
/c/Users/kevin/Desktop/nuget.exe pack DeepAI.csproj /c/Users/kevin/Desktop/nuget.exe push DeepAI.Client.1.3.0.nupkg -Timeout 3000 -Source https://www.nuget.org
Log into NuGet and point the package to the new version.
(Update readme with generated docs from: C:\Users\kevin\Documents\Visual Studio 2013\Projects\DeepAI.Client\DeepAI.Client\bin\Debug\DeepAI.md) or just upload in the web ui
(generated from XMLDOC with Vsxmd):
Contents #
- BrandsafeJob
- BrandsafeJobResults
- DeepAI_API
- #ctor(apiKey)
- realtimeStreamUtilities
- callStandardApi(model,inputs_and_options)
- callStandardApiWithBinaryResponse(model,inputs_and_options)
- getAccountInfo()
- getAvailableModelOptionsForModelName(modelName)
- getBrandsafeJob(id)
- getRealtimeStream(id)
- getRealtimeStreams()
- getVideoJob(id)
- modifyRealtimeStream(id,output_bitrate_kbps)
- objectAsJsonString(a)
- startRealtimeStream(model,input_type,output_type,fps,width,height,output_bitrate_kbps,model_options)
- startVideoJob(model,video,fps,model_options)
- stopRealtimeStream(id)
- submitBrandsafeJob(url,extra_options)
- DeepAIAccountInfo
- ObjectDictionary
- RealtimeStream
- RealtimeStreamUtilities
- Resources
- StandardApiResponse
- VideoJob
- VideoStreamFormat
DeepAI
Represents the status and results of a Brandsafe Job.
DeepAI
Represents the results of a Brandsafe Job.
DeepAI
Main API Client class - create an instance of the api by calling: DeepAI_API api = new DeepAI_API(apiKey: "...");
Call this to create a new DeepAI_API instance.
| Name | Type | Description |
|---|---|---|
| apiKey | System.String | Your DeepAI key as found in your DeepAI dashboard. |
Object with helper utilities for sending input to and playing back a realtime stream.
Call a standard API to run a model on a single image or other input, such as text file.
Reponse object with either URL or immediate data.
| Name | Type | Description |
|---|---|---|
| model | System.String | The name of the model to run. |
| inputs_and_options | System.Object | An anonymous object containing the inputs and options needed by the model, such as "image" or "style" |
Call a standard API to run a model on a single image or other input, such as text file. Returns raw bytes of the output, such as JPEG data.
Byte array representing the output of the model, typically in JPEG format.
| Name | Type | Description |
|---|---|---|
| model | System.String | The name of the model to run. |
| inputs_and_options | System.Object | An anonymous object containing the inputs and options needed by the model, such as "image" or "style" |
Get basic infomation about the account associated with the API Key
DeepAIAccountInfo object
This method has no parameters.
Get the available model options for a given model name
Object representing the possible choices of various fields
| Name | Type | Description |
|---|---|---|
| modelName | System.String | Name of the model to get options for |
Get the status and output of a brandsafe job
A BrandsafeJob object with the status of the job. Results will not be present unless the job is complete
| Name | Type | Description |
|---|---|---|
| id | System.String | The ID string of the job to get info for |
Get the info for a single realtime stream. Useful for continuously polling the status of a stream.
Stream Info object
| Name | Type | Description |
|---|---|---|
| id | System.Int32 | ID of the stream to get |
Get the full list of your active realtime streams, plus streams started or stopped in the last hour
List of stream info objects
This method has no parameters.
Get status and basic information about a video job.
VideoJob information object
| Name | Type | Description |
|---|---|---|
| id | System.Int32 | The numeric Job ID of the video to get. |
Modify a single realtime stream.
RealtimeStream object
| Name | Type | Description |
|---|---|---|
| id | System.Int32 | ID of the stream to modify |
| output_bitrate_kbps | System.Int32 | If provided, set the output bitrate of the stream to this value. |
Simple helper method to pretty-print an object response of any API call for easier viewing.
| Name | Type | Description |
|---|---|---|
| a | System.Object |
startRealtimeStream(model,input_type,output_type,fps,width,height,output_bitrate_kbps,model_options) method # =
Creates a new real-time stream. The status field will initially be "PENDING" which will transition to "RUNNING" within 5 minutes. If the provided stream does not match the width and height values passed, it will be rescaled.
RealtimeStream object containing URLs which may be used to connect to the stream by sending input and receiving output.
| Name | Type | Description |
|---|---|---|
| model | System.String | Name of the model to process the video with, such as "deepdream" or "fast-style-transfer" |
| input_type | System.String | Stream descriptor of in the input video stream. Possible values are "tcp/mpegts" or "udp/mpegts". |
| output_type | System.String | Stream descriptor of in the output video stream. Possible values are "tcp/mpegts" or "udp/mpegts". |
| fps | System.Single | Frames per second of the input video stream. The output stream will be the same frame rate. |
| width | System.Int32 | width of the video to process in pixels |
| height | System.Int32 | height of the video to process in pixels |
| output_bitrate_kbps | System.Int32 | Bitrate of the output video stream in kbps. If not provided, the system default will be used. |
| model_options | System.Collections.Generic.Dictionary{System.String,System.Object} | Dictionary of options to send to the processing model. Possible values may be retrieved with api.getAvailableModelOptionsForModelName(...) |
Creates a new single-model video job using either a file upload or a URL of the video to process.
Object with the ID and status of the new video job.
| Name | Type | Description |
|---|---|---|
| model | System.String | The model name to process the video with |
| video | System.Object | The FileStream of video data to process, or a URL to download. |
| fps | System.Single | Frames per second to process. If not given, the frame rate will be chosen automatically, typically the same as the input video, or 2fps for object detection models. |
| model_options | System.Object | Dictionary of options to pass to the given model, such as {"style": "YOUR_STYLE_CHOICE"} |
Abort a single realtime stream.
RealtimeStream object
| Name | Type | Description |
|---|---|---|
| id | System.Int32 | ID of the stream to stop |
Submit a new brandsafe job
A BrandsafeJob object with the status of the new job. Use the "id" field to query the status until it is finished.
| Name | Type | Description |
|---|---|---|
| url | System.String | The URL to scan |
| extra_options | System.Collections.Generic.Dictionary{System.String,System.Object} | An optional dictionary of extra options to pass to the API |
DeepAI
Basic information about a DeepAI account
DeepAI.DeepAI_API
Construct.
| Name | Type | Description |
|---|---|---|
| a_source | System.Object | Source object. |
Create a dictionary from the given object (a_source).
Created dictionary.
| Name | Type | Description |
|---|---|---|
| a_source | System.Object | Source object. |
| Name | Description |
|---|---|
| System.ArgumentNullException | Thrown if a_source is null. |
DeepAI
Represents the status and configuration for a single Realtime video stream.
URL at which you should send your input. This URL is compatible with ffmpeg and tools based upon it.
Currently active model options of the stream.
URL at which the results can be streamed back. This URL is compatible with ffmpeg and tools based upon it, like Ventuz.
The description of the reason for the change in status if it is known. For example, if transitioned to STOPPED due to inactivity, or FAILED due to DeepAI internal error.
One of PENDING, RUNNING, STOPPED, FAILED
DeepAI
A collection of helper functions for use with real time streams, such as sending webcam input to a stream, or playing the output of a stream.
Construct a new instance - this is done automatically as this object will be available on all DeepAI_API objects.
This constructor has no parameters.
Get the program name and arguments to launch a process that will play the output of a realtime stream.
program name and arguments as array
| Name | Type | Description |
|---|---|---|
| stream | DeepAI.RealtimeStream | The realtime stream to play. |
Get a list of availabe video capture device names.
List of string device names
This method has no parameters.
Get the frame rate and frame size combinations that the given input device supports.
Array of supported formats for the device.
| Name | Type | Description |
|---|---|---|
| deviceName | System.String | The input device to get capabilities for. |
Launches a new process to play the output of a realtime stream in a window.
Windows Process handle
| Name | Type | Description |
|---|---|---|
| stream | DeepAI.RealtimeStream | The stream to play back. |
| showWindow | System.Boolean | Set to false to hide the command prompt. (Not recommended.) |
Windows Process handle
This method has no parameters.
DeepAI.Properties
A strongly-typed resource class, for looking up localized strings, etc.
Overrides the current thread's CurrentUICulture property for all resource lookups using this strongly typed resource class.
Looks up a localized resource of type System.Byte[].
Looks up a localized resource of type System.Byte[].
Returns the cached ResourceManager instance used by this class.
DeepAI
The immediate output of the model
The private URL at which the results are available, if present.
DeepAI
Represents the status and output for a single Video job.
The estimated cost of the job if it runs to completion.
The private URL at which the results are available, if present.
One of: complete, in-progress, failed
DeepAI.RealtimeStreamUtilities
Represents the framerate and frame size of a video stream.