add nsfw api
This commit is contained in:
31
Docker/nsfw-api/README.md
Normal file
31
Docker/nsfw-api/README.md
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# NSFW识别系统
|
||||||
|
|
||||||
|
[Docker Hub](https://hub.docker.com/r/eugencepoi/nsfw_api)
|
||||||
|
|
||||||
|
## 用例
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# single prediction
|
||||||
|
curl -X GET -H 'Content-Type: application/json' http://localhost:5000\?url\=https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png
|
||||||
|
|
||||||
|
{
|
||||||
|
"score": 0.00016061133646871895,
|
||||||
|
"url": "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
"error_code": 500,
|
||||||
|
"error_reason": "[Errno -2] Name or service not known",
|
||||||
|
"url": "https://foobar"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Batch predictions
|
||||||
|
curl -X POST -H 'Content-Type: application/json' \
|
||||||
|
-d '{"images": [{"url": "http://foo.bar", "id": 1}, {"url": "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png", "id": 2, "extra_props": {"foo": "bar"}}]}' \
|
||||||
|
http://localhost:5000/batch-classify
|
||||||
|
|
||||||
|
{"predictions": [
|
||||||
|
{"url": "http://foo.bar", "error_reason": "[Errno -2] Name or service not known", "error_code": 500, "id": 1},
|
||||||
|
{"url": "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png", "score": 0.00016061133646871895, "id": 2, "extra_props": {"foo": "bar"}}
|
||||||
|
]}
|
||||||
|
```
|
||||||
16
Docker/nsfw-api/docker-compose.yml
Normal file
16
Docker/nsfw-api/docker-compose.yml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
version: "3.0"
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
container_name: nsfw_api
|
||||||
|
image: "ghcr.io/arnidan/nsfw-api:latest"
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
nginx:
|
||||||
|
aliases:
|
||||||
|
- nsfw_api
|
||||||
|
|
||||||
|
networks:
|
||||||
|
nginx:
|
||||||
|
external: true
|
||||||
@@ -3,6 +3,7 @@ services:
|
|||||||
app:
|
app:
|
||||||
container_name: nsfw-api
|
container_name: nsfw-api
|
||||||
image: eugencepoi/nsfw_api:latest
|
image: eugencepoi/nsfw_api:latest
|
||||||
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "5000:5000"
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
Reference in New Issue
Block a user