This project is a web application that classifies jokes into different humor styles using machine learning models. It allows users to input a joke and get a classification along with explanations and encouragement based on the humor style detected.
-
Humor Style Classification: The app classifies jokes into one of the following humor styles:
- Self-Enhancing
- Self-Deprecating
- Affiliative
- Aggressive
- Neutral
-
Detailed Feedback: After classification, the app provides an explanation of the detected humor style and offers encouragement or advice based on the result.
-
Probability Display: The app also shows the model's confidence (probability) in the prediction.
Make sure you have the following installed:
- Python 3.8 or higher
pip(Python package installer)
-
Clone the Repository
git clone https://github.com/MaryKenneth/humor_style_classifier_app.git cd humor_style_classifier_app -
Install the Required Packages
Install the dependencies using the provided
requirements.txtfile:pip install -r requirements.txt
-
Download the Model
Ensure you have the trained XGBoost model file (
ali_xgboost_humour_model.pkl) in the root directory of the project.
Start the Flask web application:
python app.pyThe app will be available at http://127.0.0.1:5000/ in your web browser.
- Go to the homepage of the web app.
- Enter your joke in the text box.
- Submit the joke to see its humor style classification along with an explanation and encouragement.
- The prediction probability will also be displayed to indicate how confident the model is in its prediction.
humor_style_classifier_app/
- app.py # The main Flask application file
- templates/index.html # HTML template for the homepage
- ali_xgboost_humour_model.pkl # Pre-trained XGBoost model
- requirements.txt # Lists all the dependencies needed to run the project
- README.md # This README file
- Flask: For building the web application.
- XGBoost: For training the humor classification model.
- Sentence Transformers: For embedding the text input.
Feel free to fork this repository and submit pull requests. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License. See the LICENSE file for more details.
- XGBoost
- Sentence Transformers
- Flask documentation