https://github.com/clarifai/clarifai-csharp-grpc
Clarifai gRPC C# client
https://github.com/clarifai/clarifai-csharp-grpc
ai clarifai clarifai-client csharp grpc
Last synced: about 1 year ago
JSON representation
Clarifai gRPC C# client
- Host: GitHub
- URL: https://github.com/clarifai/clarifai-csharp-grpc
- Owner: Clarifai
- License: other
- Created: 2019-10-25T14:04:31.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-04-10T15:40:50.000Z (about 1 year ago)
- Last Synced: 2025-04-10T16:54:36.075Z (about 1 year ago)
- Topics: ai, clarifai, clarifai-client, csharp, grpc
- Language: C#
- Homepage:
- Size: 13.2 MB
- Stars: 5
- Watchers: 13
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# Clarifai C# gRPC Client
This is the official Clarifai gRPC C# client for interacting with our powerful recognition
[API](https://docs.clarifai.com).
Clarifai provides a platform for data scientists, developers, researchers and enterprises to master the entire
artificial intelligence lifecycle. Gather valuable business insights from images, video and text using computer vision
and natural language processing.
* Try the Clarifai demo at: https://clarifai.com/demo
* Sign up for a free account at: https://portal.clarifai.com/signup
* Read the documentation at: https://docs.clarifai.com/
[](https://www.nuget.org/packages/ClarifaiGrpc)
[](https://github.com/Clarifai/clarifai-csharp-grpc/actions)
## Installation
Install it via the NuGet Package Manager by searching for `ClarifaiGrpc`, or use one of the commands below.
```
dotnet add package ClarifaiGrpc
Install-Package ClarifaiGrpc
```
## Versioning
This library doesn't use semantic versioning. The first two version numbers (`X.Y` out of `X.Y.Z`) follow the API (backend) versioning, and
whenever the API gets updated, this library follows it.
The third version number (`Z` out of `X.Y.Z`) is used by this library for any independent releases of library-specific improvements and bug fixes.
## Getting started
Construct the client and setup your API key or Personal Access Token in the `metadata` variable.
```csharp
using System;
using System.Collections.Generic;
using Clarifai.Api;
using Clarifai.Channels;
using Grpc.Core;
using StatusCode = Clarifai.Api.Status.StatusCode;
var client = new V2.V2Client(ClarifaiChannel.Grpc());
var metadata = new Metadata
{
{"Authorization", "Key {YOUR_PERSONAL_TOKEN}"}
};
```
Predict concepts in an image:
```csharp
var response = client.PostModelOutputs(
new PostModelOutputsRequest()
{
UserAppId =
new UserAppIDSet()
{
UserId = "{YOUR_USER_ID}",
AppId = "{YOUR_APP_ID}"
},
ModelId = "aaa03c23b3724a16a56b629203edc62c", // <- This is the general model_id
Inputs =
{
new List()
{
new Input()
{
Data = new Data()
{
Image = new Image()
{
Url = "https://samples.clarifai.com/dog2.jpeg"
}
}
}
}
}
},
metadata
);
if (response.Status.Code != StatusCode.Success)
throw new Exception("Request failed, response: " + response);
Console.WriteLine("Predicted concepts:");
foreach (var concept in response.Outputs[0].Data.Concepts)
{
Console.WriteLine($"{concept.Name, 15} {concept.Value:0.00}");
}
```