{"id":17989533,"url":"https://github.com/evilfreelancer/ru-toxicml-api","last_synced_at":"2026-05-01T13:32:26.720Z","repository":{"id":189418324,"uuid":"680637178","full_name":"EvilFreelancer/ru-toxicml-api","owner":"EvilFreelancer","description":"API service that detects toxicity in Russian text using machine learning","archived":false,"fork":false,"pushed_at":"2023-08-20T17:02:10.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-03T17:10:22.379Z","etag":null,"topics":["api","classifier","flask","label-studio","machine-learning","torch","transformers"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EvilFreelancer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2023-08-19T22:25:22.000Z","updated_at":"2023-08-20T12:19:01.000Z","dependencies_parsed_at":"2023-08-20T00:22:38.729Z","dependency_job_id":"2f87dfcd-4256-46fa-a6ca-1192c85f565e","html_url":"https://github.com/EvilFreelancer/ru-toxicml-api","commit_stats":null,"previous_names":["evilfreelancer/ru-toxicml-api"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/EvilFreelancer/ru-toxicml-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilFreelancer%2Fru-toxicml-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilFreelancer%2Fru-toxicml-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilFreelancer%2Fru-toxicml-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilFreelancer%2Fru-toxicml-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EvilFreelancer","download_url":"https://codeload.github.com/EvilFreelancer/ru-toxicml-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EvilFreelancer%2Fru-toxicml-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32499681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["api","classifier","flask","label-studio","machine-learning","torch","transformers"],"created_at":"2024-10-29T19:14:53.536Z","updated_at":"2026-05-01T13:32:26.693Z","avatar_url":"https://github.com/EvilFreelancer.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Russian Toxicity Classifier API\n\nIn the age of digital communication, the spread of harmful content has become a prevalent issue. To address this, the\nRussian Toxicity Classifier API aims to detect and classify potentially toxic comments in Russian language texts. By\nleveraging advanced machine learning techniques and models from the Hugging Face's transformers library, this service\ncan identify whether a given text is neutral or toxic. This not only assists in content moderation but also provides a\ntool for researchers, developers, and platforms to better understand and manage online interactions in the Russian\ndigital space.\n\nFurthermore, this API is fully compatible with [Label Studio](https://labelstud.io/) and can be seamlessly\nintegrated as a machine learning backend, enabling users to take advantage of the powerful labeling tools provided by\nLabel Studio while benefiting from the toxicity classification capabilities of this service.\n\nThis project serves a simple Flask API that uses a model from the Hugging Face's transformers library to classify\nRussian text as either neutral or toxic. The model in use is\n[s-nlp/russian_toxicity_classifier](https://huggingface.co/s-nlp/russian_toxicity_classifier).\n\n\u003e More details here: https://dzen.ru/a/ZOIIrENDVgjvKrGB (on russian)\n\n## Requirements\n\n* Docker\n* Docker Compose\n* NVIDIA GPU (For CUDA operations)\n\n## Additional Information\n\nThe Docker container is set up to use NVIDIA GPUs, optimized for CUDA operations. Ensure that you have the necessary\nNVIDIA drivers installed on your machine.\n\n## Settings / Labeling Interface\n\nFor those using Label Studio, the following configuration can be set up for the labeling interface:\n\n```xml\n\u003cView\u003e\n    \u003cText name=\"text\" value=\"$text\"/\u003e\n    \u003cChoices name=\"sentiment\" toName=\"text\" showInLine=\"true\"\u003e\n        \u003cChoice value=\"toxic\" background=\"red\"/\u003e\n        \u003cChoice value=\"neutral\" background=\"gray\"/\u003e\n    \u003c/Choices\u003e\n\u003c/View\u003e\n```\n\nThis configuration allows users to label texts with either \"toxic\" or \"neutral\" sentiments. The choices are displayed\nin-line, with distinct colors for each sentiment.\n\n## Dependencies\n\n* Flask (v1.1.2)\n* transformers (v4.31.0)\n* PyTorch (v2.0.1)\n* gunicorn (v20.1.0)\n* label-studio-sdk (v0.0.30)\n* label-studio-ml (v1.0.9)\n* rq (v1.15.1)\n\n## Setup and Installation\n\nCopy compose file:\n\n```shell\ncp docker-compose.dist.yml docker-compose.yml\n```\n\nBuilding the Docker Image:\n\n```shell\ndocker-compose build\n```\n\nRunning the Application:\n\n```shell\ndocker-compose up -d\n```\n\n## API Endpoints\n\n## Health Check\n\nYou can check the health status of the service by simply accessing its root (`/`) URL.\n\n* URL: `/`\n* Method: `GET`\n\nIf everything is running correctly, you should see:\n\n```json\n{\n  \"model_dir\": null,\n  \"status\": \"UP\",\n  \"v2\": false\n}\n```\n\nThis indicates that the service is up and running.\n\n## Predict Toxicity\n\nThe Predict Toxicity endpoint allows users to submit an array of text strings in Russian. The service then evaluates\neach text string and returns predictions indicating whether each text is neutral or toxic. Additionally, a score\nrepresenting the confidence of the prediction is provided.\n\n* URL: `/predict`\n* Method: `POST`\n\nData Params:\n\n```json\n{\n  \"tasks\": [\n    {\"data\": {\"text\": \"Your text 1\"}},\n    {\"data\": {\"text\": \"Your text 2\"}}\n  ]\n}\n```\n\ncURL Example:\n\n```shell\ncurl -X POST \"http://localhost:5000/predict\" -H \"Content-Type: application/json\" -d '{\n  \"tasks\": [\n    {\"data\": {\"text\": \"Your text 1\"}},\n    {\"data\": {\"text\": \"Your text 2\"}}\n  ]\n}'\n```\n\nSuccess Response:\n\n```json\n[\n  {\n    \"result\": [\n      {\n        \"from_name\": \"sentiment\",\n        \"to_name\": \"text\",\n        \"type\": \"choices\",\n        \"value\": {\n          \"choices\": [\n            \"neutral\"\n          ]\n        }\n      }\n    ],\n    \"score\": 0.1234\n  },\n  ...\n]\n```\n\n## Links\n\n* https://dzen.ru/a/ZOIIrENDVgjvKrGB\n* https://huggingface.co/s-nlp/russian_toxicity_classifier\n* https://github.com/HumanSignal/label-studio-ml-backend/tree/master\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilfreelancer%2Fru-toxicml-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevilfreelancer%2Fru-toxicml-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevilfreelancer%2Fru-toxicml-api/lists"}