{"id":18275356,"url":"https://github.com/rahiel/open_nsfw--","last_synced_at":"2025-04-05T03:30:58.278Z","repository":{"id":45906103,"uuid":"94104801","full_name":"rahiel/open_nsfw--","owner":"rahiel","description":"API to classify images as  SFW/NSFW.","archived":false,"fork":false,"pushed_at":"2023-04-15T11:48:42.000Z","size":21636,"stargazers_count":69,"open_issues_count":4,"forks_count":21,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-03T22:02:19.156Z","etag":null,"topics":["deep-learning","docker-image","nudity-detection"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rahiel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-yahoo.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-12T14:21:32.000Z","updated_at":"2024-11-11T04:23:05.000Z","dependencies_parsed_at":"2024-11-05T12:12:41.311Z","dependency_job_id":null,"html_url":"https://github.com/rahiel/open_nsfw--","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahiel%2Fopen_nsfw--","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahiel%2Fopen_nsfw--/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahiel%2Fopen_nsfw--/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rahiel%2Fopen_nsfw--/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rahiel","download_url":"https://codeload.github.com/rahiel/open_nsfw--/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247284911,"owners_count":20913691,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","docker-image","nudity-detection"],"created_at":"2024-11-05T12:12:35.954Z","updated_at":"2025-04-05T03:30:53.266Z","avatar_url":"https://github.com/rahiel.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# open_nsfw--\n\nThis is a fork of Yahoo's [open_nsfw][]. The goal is to make the *Not Suitable\nfor Work* (NSFW) classification model easily accessible through an HTTP API\ndeployable with Docker.\n\nAs I couldn't make this work on Buster due to insufficient knowledge of the\ntread system, I have edited the requirements to support Python 3.5.\n\n# Install\n\nFirst [install Docker][docker] (available in Debian as [docker.io][dpkg]), then\ngive the user you want to run the API as permission to use Docker:\n``` shell\nsudo gpasswd -a $USER docker\n```\nYou need to logout and login again for this to take effect.\n\nNow build the image, this might take a while:\n``` shell\ndocker build -t open_nsfw https://raw.githubusercontent.com/rahiel/open_nsfw--/master/Dockerfile\n```\n\nThen you can start the API:\n``` shell\ndocker run -p \u003cport\u003e:8080 open_nsfw\n```\nwhere you replace `\u003cport\u003e` with the port number you want to have the API\naccessible on your local machine.\n\n[open_nsfw]: https://github.com/yahoo/open_nsfw\n[docker]: https://docs.docker.com/engine/installation/\n[dpkg]: https://packages.debian.org/sid/docker.io\n\n# Usage\n\nThe API is very simple, you POST an `url` of an image and the API will then\nfetch it, classify it and return the probability that it's NSFW. The probability\nis expressed as a real number between 0 and 1.\n\nIn the following examples I assume you picked 8080 for the port number, so the\nAPI is running at `localhost:8080`.\n\nWith curl:\n``` shell\ncurl -d 'url=http://example.com/image.jpg' localhost:8080\n```\n\nWith Python:\n``` python\nimport requests\nr = requests.post(\"http://localhost:8080\", data={\"url\": \"http://example.com/image.jpg\"})\nnsfw_prob = float(r.text)\n```\n\n# HTTP Errors\n\n## 400 Bad Request: Missing `url` POST parameter\n\nYou need to specify `url` as a POST parameter.\n\n## 404 Not Found\n\nThe requested `url` leads to an HTTP 404 Not Found error.\n\n## 415 Unsupported Media Type: Invalid image\n\nThe requested `url` is not a valid image.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahiel%2Fopen_nsfw--","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frahiel%2Fopen_nsfw--","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frahiel%2Fopen_nsfw--/lists"}