This application uses machine learning to classify movies into genres based on their descriptions.
This project includes a FastAPI-based API and a Streamlit web application for classifying movie genres based on their descriptions. The machine learning models used in this project include Logistic Regression, Support Vector Classifier, and Balanced Random Forest.
project_root/
│
├── app.py
├── streamlit_app.py
├── models/
│ ├── Logistic_Regression_piped.pkl
│ ├── SVM_piped.pkl
│ └── balanced_random_forest.pkl
└── static/
├── images/
│ ├── api.png
│ ├── icon.png
│ └── cover.jpg
├── about.md
└── metrics.md
app.py
: Defines the FastAPI application.streamlit_app.py
: Defines the streamlit webapp.Dockerfile
: Dockerfile for building the Docker image.docker-compose.yml
: Docker Compose file for orchestrating the services.requirements.txt
: List of dependencies.models/
: Directory containing pre-trained machine learning models.static/
: Directory containing static files such as images used in the interface.
- Clone the repository
git clone https://github.com/Sibikrish3000/movie-genre-classification.git
cd movie-genre-classification
- Install dependencies
pip install -r requirements.txt
- Download NLTK data:
python -m nltk.downloader punkt
python -m nltk.downloader stopwords
- Ensure the following directory structure and files are in place
project_root/
│
├── app.py
├── streamlit_app.py
├── notebook/
├── models/
│ ├── Logistic_Regression_piped.pkl
│ ├── SVM_piped.pkl
│ └── balanced_random_forest.pkl
└── static/
├── images/
│ ├── api.png
│ ├── icon.png
│ └── cover.jpg
├── about.md
└── metrics.md
- Start the FastAPI server
uvicorn app:app --host 0.0.0.0 --port 8000 --reload
- Run the Streamlit application
streamlit run streamlit_app.py
-
Build and start the containers:
docker network create AIservice
docker-compose up --build
-
Access the streamlit webapp at http://localhost:8501.
Click the button below to start a new development environment:
- Enter Movie Description: Input the movie description you want to classify.
- Predict: Click the "Predict" button to see the classification result.
- URL:
/
- Method:
GET
- Response: HTML home page
- URL:
/predict
- Method:
POST
- Payload: JSON object with movie description and model selection
- Response: JSON object with predicted genre
The Streamlit web application provides a user-friendly interface for movie genre classification. Users can input a movie description, select a model, and receive a genre prediction. The app also includes an "About" section and a "Metrics" section with relevant information.
This project is licensed under the MIT License. See the LICENSE file for details.
Sibi Krishnamoorthy