Skip to content

Commit af5a136

Browse files
author
Eugen Cepoi
committed
More doc
1 parent 28f1672 commit af5a136

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

README.MD

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Nudity image detection HTTP API
2+
13
This project provides a ready to deploy REST API allowing to predict if an image is offensive or has adult content.
24

35
It relies on [open_nsfw](https://github.com/yahoo/open_nsfw), which provides a pre-trained open source neural network model for [Caffe](https://github.com/BVLC/caffe).
@@ -74,11 +76,15 @@ and `error_reason` instead of the `score`:
7476
}
7577
```
7678

77-
##### Batch predictions
78-
7979
Remark that doing the classification isn't a fast operation so you shouldn't call this API in places where you want the
80-
response in real time/low latency (for ex. to display it to the user), but instead call the API periodically. For that
81-
purpose use the batch classification API as follows.
80+
response in real time/low latency (for ex. to display it to the user), but instead call the API periodically for a batch
81+
of images using the endpoint below.
82+
83+
#### Batch predictions with streamed responses
84+
85+
The batch endpoint takes as input a list of images to classify and returns the result for each image. The response is
86+
being streamed back, so you could read it in a streaming fashion and process the results as they come in (as opposed
87+
to wait for the entire response before processing it). For that purpose use the batch classification API as follows.
8288

8389
```
8490
curl -X POST -H 'Content-Type: application/json' \
@@ -94,11 +100,7 @@ curl -X POST -H 'Content-Type: application/json' \
94100
Each entry should have an `url` property pointing to the image accessible over HTTP/HTTPS. Any extra attribute will be
95101
preserved and sent back in the response. This allows easily to identify each entry and eventually pass along some context.
96102

97-
Note that the response is being streamed back, so you could read it in a streaming fashion and process the results as
98-
they come in (as opposed to wait for the entire response before processing it). This is mostly done to work around
99-
Heroku's 30s Request timeout.
100-
101-
Note that failing to process one entry in the batch will not fail the entire operation, instead the result for this single
103+
Failing to process one entry in the batch will not fail the entire operation, instead the result for this single
102104
entry will report the error. However if there is an error in handling the input JSON or some other global error the format
103105
of the response is not guaranteed so you should check the response status code.
104106

0 commit comments

Comments
 (0)