Spaces:
Sleeping
title: Spam Email Classifier
emoji: 🦀
colorFrom: yellow
colorTo: red
sdk: docker
pinned: false
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
Spam Email Classifier
A simple Machine Learning project to classify spam email and normal email. This project is to understand basic concepts of LLM and deploy a model on a server using fastapi and interact with HTML UI
Dataset
This project utilizes the Spam Emails Dataset, a dataset in machine learning that contains many samples of Emails and messages, each classifier into two classes: ham(for legit email) and spam (for spam email)
Installation & Setup
Prerequisites
- Python 3.8+
- FastAPI
- Scikit-learn
- Pandas
- HTML
Export classification model
- To re-train or export new models run command:
python export_model.py
Running Steps using Docker (Port 8888)
Clone the repository
Clone the project repository to your local machine.git clone <repository-url> cd <repository-folder>Install dependencies
Install the required Python dependencies.pip install -r requirements.txtBuild Docker Image
docker build -t app .Run Docker Image
docker run -p 8888:8888 app
Running Steps Locally (If run locally, default port will be 8000)
Clone the repository
Clone the project repository to your local machine.git clone <repository-url> cd <repository-folder>Install dependencies
Install the required Python dependencies.pip install -r requirements.txtStart the FastAPI server
Run the FastAPI server to serve the model (default port 8000).127.0.0.1:8000uvicorn server:app --reloador
python -m uvicorn server:app --reloadAccess API Documentation
Open the following API documentation in your browser:- Local Server:
- Swagger UI: http://127.0.0.1:8000/docs
- Redoc: http://127.0.0.1:8000/redoc
- Remote Sever using Hugging Face: https://dangminh214-spam-email-classifier.hf.space/docs
- Local Server:
Run the client-side application
Open web/index.html in web browser
API Endpoints
POST /predict
Predicts the E-Mail if it is a Spam E-Mail or not
- Request Body (JSON):
{ "text": "Hi I am Minh" } - Response:
{ "prediction": "ham" }
GET /
Give the information of project to user
- Response:
{ "info": "Welcome to Dang Minh EMail Spam Classifier Model, this is a personal project to practice my knowledge in NLP and MLops" }
Deploy remotely on HF
Server URL
bash https://dangminh214-spam-email-classifier.hf.space
Expandability
This project can be expanded beyond just the provided HTML file. It can be integrated with other web frameworks, such as ReactJS, to create an even more interactive and user-friendly interface. This will further enhance the usability and scalability of the application.
Demo Usage
Contributing
Contributions are welcome! If you find any issues or want to suggest improvements, feel free to open an issue or submit a pull request.
License
This project is licensed under the MIT License.

