<commit_before># ML API

## Roadmap
* [x] Limit requests access per ip address
* [x] Limit requests access per token
* [x] Filter by query
* [ ] Allow customer post a image url and return the result of predictions
* [ ] Filter by customer's image

## Architecture Diagram
![Machine Learning Service Application Architecture](https://c7.staticflickr.com/6/5467/30326223422_fb15e3c2c8_b.jpg)

## How to run
```
git clone <EMAIL>:ntamvl/deepdetect-client-rails-example.git
bundle install

# edit config/database.yml then run
rails db:create && rails db:migrate && rails db:seed

# run on development
rails s -b 0.0.0.0

# run on production as daemonize<commit_msg>update readme:<commit_after># ML API

## Roadmap
* [x] Limit requests access per ip address
* [x] Limit requests access per token
* [x] Filter by query
* [ ] Allow customer post a image url and return the result of predictions
* [ ] Filter by customer's image

## Architecture Diagram
![Machine Learning Service Application Architecture](https://c7.staticflickr.com/6/5467/30326223422_fb15e3c2c8_b.jpg)

## Requirements
- Ubuntu 14.04 or Ubuntu 16.04
- Rails 5+
- Ruby 2.2+

## Install DeepDetect
**Install dependencies:**
```
sudo apt-get install build-essential libgoogle-glog-dev libgflags-dev libeigen3-dev libopencv-dev libcppnetlib-dev libboost-dev libboost-iostreams-dev libcurlpp-dev libcurl4-openssl-dev protobuf-compiler libopenblas-dev libhdf5-dev libprotobuf-dev libleveldb-dev libsnappy-dev liblmdb-dev libutfcpp-dev cmake libgoogle-perftools-dev unzip
```

**Clone & build deepdetect:**
```
cd && mkdir Projects && git clone <EMAIL>:beniz/deepdetect.git
cd deepdetect && mkdir build
cd build
cmake ..
make
```

## How to run
```
git clone <EMAIL>:ntamvl/deepdetect-client-rails-example.git
bundle install

# edit config/database.yml then run
rails db:create && rails db:migrate && rails db:seed

# run on development
rails s -b 0.0.0.0

# run on production as daemonize
{'fraction_non_alphanumeric': 0.10648148148148148, 'fraction_numerical': 0.033950617283950615, 'mean_word_length': 4.720588235294118, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5842621', 'n_tokens_mistral': 698, 'n_tokens_neox': 628, 'n_words': 203}