Update README.md
Browse files
README.md
CHANGED
|
@@ -1,122 +1,11 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
There are docker images bundled with models v3 from https://github.com/gantman/nsfw_model:
|
| 13 |
-
|
| 14 |
-
* `ghcr.io/arnidan/nsfw-api:latest` - bundled with TensorflowJS 299x299 Image Model (better detection, as for me)
|
| 15 |
-
* `ghcr.io/arnidan/nsfw-api:latest-min` - bundled with TensorflowJS Quantized 299x299 Image Model (see [#39](https://github.com/arnidan/nsfw-api/issues/49))
|
| 16 |
-
|
| 17 |
-
Each image is available for `linux/amd64` and `linux/arm64` platforms.
|
| 18 |
-
|
| 19 |
-
```
|
| 20 |
-
docker run -p 3000:3000 ghcr.io/arnidan/nsfw-api:latest
|
| 21 |
-
```
|
| 22 |
-
|
| 23 |
-
<details>
|
| 24 |
-
<summary>docker-compose.yml example</summary>
|
| 25 |
-
|
| 26 |
-
```yaml
|
| 27 |
-
version: "3.9"
|
| 28 |
-
|
| 29 |
-
services:
|
| 30 |
-
nsfw-api:
|
| 31 |
-
image: "ghcr.io/arnidan/nsfw-api:latest"
|
| 32 |
-
ports:
|
| 33 |
-
- "3000:3000"
|
| 34 |
-
restart: always
|
| 35 |
-
```
|
| 36 |
-
|
| 37 |
-
</details>
|
| 38 |
-
|
| 39 |
-
### Manual deploy
|
| 40 |
-
|
| 41 |
-
1. Clone the repo
|
| 42 |
-
2. Download and unpack model from [models repo](https://github.com/gantman/nsfw_model) to `model` folder
|
| 43 |
-
3. `yarn`
|
| 44 |
-
4. `yarn build`
|
| 45 |
-
5. `yarn start`
|
| 46 |
-
|
| 47 |
-
Now app started on port 3000.
|
| 48 |
-
|
| 49 |
-
## API Methods
|
| 50 |
-
|
| 51 |
-
- POST /classify
|
| 52 |
-
- POST /classify-many
|
| 53 |
-
|
| 54 |
-
### POST /classify
|
| 55 |
-
|
| 56 |
-
#### Example of the request
|
| 57 |
-
|
| 58 |
-
```http request
|
| 59 |
-
POST /classify HTTP/1.1
|
| 60 |
-
Content-Type: multipart/form-data
|
| 61 |
-
```
|
| 62 |
-
|
| 63 |
-
Image should be provided in `image` field.
|
| 64 |
-
|
| 65 |
-
#### Example of the response
|
| 66 |
-
|
| 67 |
-
```
|
| 68 |
-
HTTP/1.1 200 OK
|
| 69 |
-
Content-Type: application/json
|
| 70 |
-
```
|
| 71 |
-
```json
|
| 72 |
-
{
|
| 73 |
-
"porn": 0.59248286485672,
|
| 74 |
-
"sexy": 0.39802199602127075,
|
| 75 |
-
"hentai": 0.006243097595870495,
|
| 76 |
-
"neutral": 0.0031403270550072193,
|
| 77 |
-
"drawing": 0.00011181648733327165
|
| 78 |
-
}
|
| 79 |
-
```
|
| 80 |
-
|
| 81 |
-
### POST /classify-many
|
| 82 |
-
|
| 83 |
-
#### Example of the request
|
| 84 |
-
|
| 85 |
-
```http request
|
| 86 |
-
POST /classify-many HTTP/1.1
|
| 87 |
-
Content-Type: multipart/form-data
|
| 88 |
-
```
|
| 89 |
-
|
| 90 |
-
Images should be provided in `images` field.
|
| 91 |
-
|
| 92 |
-
#### Example of the response
|
| 93 |
-
|
| 94 |
-
```
|
| 95 |
-
HTTP/1.1 200 OK
|
| 96 |
-
Content-Type: application/json
|
| 97 |
-
```
|
| 98 |
-
```json
|
| 99 |
-
[
|
| 100 |
-
{
|
| 101 |
-
"porn": 0.3996206820011139,
|
| 102 |
-
"neutral": 0.388679563999176,
|
| 103 |
-
"sexy": 0.19470958411693573,
|
| 104 |
-
"hentai": 0.015063910745084286,
|
| 105 |
-
"drawing": 0.001926235854625702
|
| 106 |
-
},
|
| 107 |
-
{
|
| 108 |
-
"sexy": 0.8366416692733765,
|
| 109 |
-
"porn": 0.13645528256893158,
|
| 110 |
-
"neutral": 0.0222245492041111,
|
| 111 |
-
"hentai": 0.004213324282318354,
|
| 112 |
-
"drawing": 0.0004651622730307281
|
| 113 |
-
},
|
| 114 |
-
{
|
| 115 |
-
"sexy": 0.8017168045043945,
|
| 116 |
-
"porn": 0.1770564466714859,
|
| 117 |
-
"neutral": 0.015829339623451233,
|
| 118 |
-
"hentai": 0.005097625777125359,
|
| 119 |
-
"drawing": 0.00029983260901644826
|
| 120 |
-
}
|
| 121 |
-
]
|
| 122 |
-
```
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
title: nsfw api
|
| 4 |
+
sdk: docker
|
| 5 |
+
emoji: 📊
|
| 6 |
+
colorFrom: blue
|
| 7 |
+
colorTo: yellow
|
| 8 |
+
app_file: build/index.js
|
| 9 |
+
app_port: 3000
|
| 10 |
+
pinned: false
|
| 11 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|