codeproject/ai-server

By codeproject

Updated over 1 year ago

Our standalone open-source AI server

Image
76

500K+

codeproject/ai-server repository overview

made-for-VSCode made-with-python GitHub license Open Source Love svg2

CodeProject.AI Server

A standalone, self-hosted, fast, free and Open Source Artificial Intelligence microserver for any platform, any language. It can be installed locally, required no off-device or out of network data transfer, and is easy to use.

For a full rundown of how to use this image, please read the docs

To use this Docker image

  1. Install Docker.
    Create an account at https://www.docker.com/ and download and install Docker Desktop
  2. Pull this Docker Image
    In a command terminal run docker pull codeproject/ai-server
  3. Create a Container and run in Docker Desktop
    In Docker Desktop, select the Images tab, hover over 'codeproject/ai-server' and click 'Run'. Select 'Optional Settings' and enter '32168' for Host port. Click Run

To use the GPU enabled images

The Docker GPU version is specific to nVidia's CUDA enabled cards with compute capability >= 6.0. In order to ensure the Docker image has access to the GPU hardware, you need to use the -gpus all flag:

docker run --name CodeProject.AI-Server -d -p 32168:32168 --gpus all ^
 --mount type=bind,source=C:\ProgramData\CodeProject\AI\docker\data,target=/etc/codeproject/ai ^
 --mount type=bind,source=C:\ProgramData\CodeProject\AI\docker\modules,target=/app/modules ^
   codeproject/ai-server:gpu

Native Windows Installer

There is also a native Windows Native installer which runs as a Windows Service and includes GPU support.

Why

Object detection

  1. AI programming is something every single developer should be aware of. We wanted a fun project we could use to help teach developers and get them involved in AI. We'll be using SenseAI as a focus for articles and exploration to make it fun and painless to learn AI programming.

  2. We got sick of fighting versions and libraries and models and being blocked by tiny annoying things every step of the way. So we put put this together so we could save you the frustration. We'll take care of the housekeeping, you focus on the code.

  3. We also got sick of needing to sign up to potentially expensive services for AI functionality. This is something we need, and by sharing maybe you can use it too, and hopefully add your own modules and improvements along the way.

Cut to the chase: how do I play with it?

1: Running and playing with the features
  1. Pull the docker image or installer the latest Windows version.
  2. Browse to http://localhost:5000 to launch the server's dashboard.
  3. On the dashboard, top and centre, is a link to the CodeProject AI Explorer. Open that and play!
2: Running and debugging the code
  1. Clone the CodeProject AI repository.
  2. Make sure you have Visual Studio Code or Visual Studio 2019+ installed.
  3. Run the setup script in /Installers/Dev
  4. Debug the front-end server application (see notes below, but it's easy)

How do I use it in my application?

Here's an example of using the API for scene detection using a simple JavaScript call:

<html>
<body>
Detect the scene in this file: <input id="image" type="file" />
<input type="button" value="Detect Scene" onclick="detectScene(image)" />

<script>
function detectScene(fileChooser) {
    var formData = new FormData();
    formData.append('image', fileChooser.files[0]);

    fetch('http://localhost:5000/v1/vision/detect/scene', {
        method: "POST",
        body: formData
    })
    .then(response => {
        if (response.ok) response.json().then(data => {
            console.log(`Scene is ${data.label}, ${data.confidence} confidence`)
        });
    });
}
</script>
</body>
</html>

You can include the CodeProject AI installer (or just a link to the latest version of the installer) in your own apps and installers and voila, you have an AI enabled app.

What does it include?

CodeProject AI includes

  1. A HTTP REST API Server. The server listens for requests from other apps, passes them to the backend analysis services for processing, and then passes the results back to the caller. It runs as a simple self contained web service on your device.
  2. Backend Analysis services. The brains of the operation is in the analysis services sitting behind the front end API. All processing of data is done on the current machine. No calls to the cloud and no data leaving the device.
  3. The Source Code, naturally.

What can it do?

It can detect stuff!

This CodeProject AI container can

  • Detect objects in images
  • Detect faces in images
  • Detect the type of scene represented in an image
  • Recognise faces that have been registered with the service
  • Provide Custom object detection. We include a license plate detector, but you can add other detection models.

The development version of CodeProject.AI includes other modules including further image processing, text processing and demo modules to help you understand how to add your own modules and to explore the possibilities. We will be constantly expanding the feature list.

Our Goals

  1. To promote AI development and inspire the AI developer community to dive in and have a go. AI is here, it's in demand, and it's a huge paradigm change in the industry. Whether you like AI or not, developers owe it to themselves to experiment in and familiarise themselves with the technology. This is CodeProject AI: a demonstration, a playground, a learning tool, and a library and service that can be used out of the box.
  2. To make AI development easy. It's not that AI development is that hard. It's that there are so, so many options. Our architecture is designed to allow any AI implementation to find a home in our system, and for our service to be callable from any language.
  3. To focus on core use-cases. We're deliberately not a solution for everyone. Instead we're a solution for common day-to-day needs. We will be adding dozens of modules and scores of AI capabilities to our system, but our goal is always clarity and simplicity over a 100% solution.
  4. To tap the expertise of the Developer Community. We're not experts but we know a developer or two out there who are. The true power of CodeProject AI comes from the contributions and improvements from our AI community.
Supported Development Environments

This current release works in Visual Studio 2019+ on Windows 10+, and Visual Studio Code on Windows 10+. Ubuntu and macOS (both Intel and Apple Silicon). The current release focuses solely on CPU support, but future releases will include GPU support.

How to Guides

Tag summary

Content type

Image

Digest

sha256:fff2c957f

Size

2.5 GB

Last updated

over 1 year ago

Requires Docker Desktop 4.37.1 or later.