# Gotography: Image classifier

Credits for the model and inspiration for the Go implementation belong to <https://www.photoprism.app/>.

    classify --help
    A not-so-simple image submission platform - Image classifier

    Usage:
      classify [flags]

    Flags:
      -a, --address ip    The listen IP address of the server (default 127.0.0.1)
      -h, --help          help for classify
      -p, --port uint16   The listen port of the server (default 8080)
      -v, --version       version for classify

## Running using Docker

(See [the GitLab documentation](https://docs.gitlab.com/ee/user/packages/container_registry/authenticate_with_container_registry.html) to configure docker to pull from the container registry)

```bash
docker run --rm -it -p 8080:8080 registry.gitlab.ost.ch:45023/gotography/classify:latest -a 0.0.0.0 -p 8080
```

[http://localhost:8080/classify](http://localhost:8080/classify) will now accept a POST with the image to classify as body.

```bash
curl -X POST -H "Content-Type: image/jpeg" --upload-file filename.jpg http://localhost:8080/classify
```

## Build under GNU/Linux

```bash
# Create and enter dist directory (ATTENTION: Gets removed by make clean_all)
mkdir dist
cd dist

# Download the TensorFlow C libraries (linux, cpu)
wget https://dl.photoprism.app/tensorflow/amd64/libtensorflow-amd64-1.15.2.tar.gz

# Extract the TensorFlow C libraries and configure the linker
sudo tar -C /usr/local -xzf libtensorflow-amd64-1.15.2.tar.gz
sudo ldconfig /usr/local/lib

# Download and unzip the model
wget https://dl.photoprism.app/tensorflow/nasnet.zip
unzip nasnet.zip
```

Now it should be possible to `make` the binary.
