{"id":17859873,"url":"https://github.com/nirmit27/sms-spam-classifier","last_synced_at":"2026-04-11T03:33:23.050Z","repository":{"id":259592658,"uuid":"878899578","full_name":"nirmit27/SMS-Spam-Classifier","owner":"nirmit27","description":"This is a web service for the classification of SMS messages created using Flask.","archived":false,"fork":false,"pushed_at":"2025-02-16T11:02:38.000Z","size":2397,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T20:12:22.597Z","etag":null,"topics":["api-rest","flask","flask-api","machine-learning","nlp","nlp-machine-learning","postman","python","sms-spam-classification","sms-spam-detection","spam-classification","spam-detection"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nirmit27.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-10-26T12:18:49.000Z","updated_at":"2025-02-16T11:02:41.000Z","dependencies_parsed_at":"2024-10-26T19:40:55.245Z","dependency_job_id":"edd3c32d-d5dd-47f8-87c6-62263eec4190","html_url":"https://github.com/nirmit27/SMS-Spam-Classifier","commit_stats":null,"previous_names":["nirmit27/sms-spam-classifier"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirmit27%2FSMS-Spam-Classifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirmit27%2FSMS-Spam-Classifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirmit27%2FSMS-Spam-Classifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nirmit27%2FSMS-Spam-Classifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nirmit27","download_url":"https://codeload.github.com/nirmit27/SMS-Spam-Classifier/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246884768,"owners_count":20849554,"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":["api-rest","flask","flask-api","machine-learning","nlp","nlp-machine-learning","postman","python","sms-spam-classification","sms-spam-detection","spam-classification","spam-detection"],"created_at":"2024-10-28T07:03:49.316Z","updated_at":"2025-12-30T22:33:10.990Z","avatar_url":"https://github.com/nirmit27.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SMS Spam Classification\n\nThis project is a web service for SMS spam classification, built using the [**Flask**](https://flask.palletsprojects.com/en/stable/) framework and deployed on [**Render**](https://docs.render.com/free). It leverages a trained machine learning model to classify SMS messages as either `HAM` (legitimate) or `SPAM`.\n\n## Overview\nThis web service provides a user interface and an API endpoint to classify SMS messages as **spam** or **ham** based on a trained machine learning model. The application utilizes a **Random Forest Classifier** and **TF-IDF vectorizer**, stored in [rfc-model.pkl](./rfc-model.pkl) and [tfidf-vectorizer.pkl](./tfidf-vectorizer.pkl) files, respectively.\n\n## Setup\n\n### Prerequisites\n\n* Python 3.8+\n* nltk\n* scikit-learn\n* Flask\n\n    For more details, refer to the [requirements.txt](./requirements.txt) for this project.\n\n### Installation\n\n1. **Clone the repository** :\n\n    ```bash\n    git clone https://github.com/nirmit27/SMS-Spam-Classifier.git\n    cd sms-spam-classifier\n    ```\n\n2. **Install dependencies** :\n\n    ```bash\n    pip install -r requirements.txt\n    ```\n\n3. **Run the application locally** :\n\n    ```bash\n    python app.py\n    ```\n\n    The application will be available at **http://127.0.0.1:5000** if you have followed through correctly.\n\n## Usage\n\n### Local Testing\n\nTo classify a message, you can use the `/api/label` endpoint :\n\n```bash\ncurl -X POST http://127.0.0.1:5000/api/label -H \"Content-Type: application/json\" -d '  {\"message\": \"Congratulations! You have won a prize.\"}'\n```\n\n## Preview\n\nHere are screenshots of the application in action :\n\n* Taking user input in the text box to classify an SMS message.\n  \n  ![User Input](./static/input.png)\n\n* Displaying the classification result as \"HAM\" or \"SPAM\" based on the input.\n\n    ![Result](./static/result.png)\n\n## API Endpoint\n\n#### `POST /api/label`\n\n* **Description**: Classifies an SMS message as HAM or SPAM.\n* **Request Body**: JSON object with a single key :\n  \n    ```json\n    {\n      \"message\": \"Your SMS message here.\"\n    }\n    ```\n\n* **Response**: JSON object with the classification label :\n  \n    ```json\n    {\n      \"message\": \"Your SMS message here.\",\n      \"label\": \"HAM\" // or \"SPAM\"\n    }\n    ```\n\n## Error Handling\nThe application handles errors with custom templates :\n\n* **404 Not Found :** Returns a `404` page if the route does not exist.\n* **500 Internal Server Error :** Returns a `500` page for server-related errors.\n\n## License\nThis project is licensed under the [MIT](https://opensource.org/license/mit) License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnirmit27%2Fsms-spam-classifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnirmit27%2Fsms-spam-classifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnirmit27%2Fsms-spam-classifier/lists"}