This API endpoint, built with hono-js
, uses a vector database from Upstash and is deployed on Cloudflare as a worker. It checks the profanity level of a given message and returns a response indicating whether the message contains profanity, along with a score representing the severity.
- Profanity Detection: Analyze messages for profanity.
- Scoring System: Receive a score indicating the severity of the profanity.
- Deployment: Seamless deployment as a Cloudflare Worker.
-
Clone the repository:
git clone https://github.com/MansoorHussain12/profanity-api.git cd profanity-api
-
Install Dependecies:
npm install
-
Configure Upstash:
- Set up your Upstash vector database and obtain your credentials.
- Create Wrangler.toml file and add Upstash credentials to it.
-
Deploy on Cloudflare:
-
npm run deploy
-
To check the profanity level of a message, send a POST
request to the API endpoint with a JSON object containing the message.
Request
{
"message": "Hello World"
}
Response If no profanity is detected:
{
"isProfanity": false,
"score": 0.76693106
}