This repository contains a deep learning-based application for classifying images as either exhibiting a "Cleft Lip & Palate" or being "Non-Cleft". It provides a simple web interface for users to upload an image and receive instant predictions along with a confidence score.
app.py: The main entry point for the web application, built using Streamlit. It handles the user interface, image uploading, and displaying the prediction results and confidence scores.inference.py: Handles the machine learning prediction pipeline. It loads the PyTorch model, pre-processes the uploaded image (resizing to 224x224), runs it through the model, and extracts the predicted label and confidence.model.py: Defines the neural network architecture. It uses a ResNet-18 architecture (fromtorchvision.models) and modifies the final fully connected layer to output predictions for 2 classes.requirements.txt: Contains the Python dependencies required to run the project.model/: A directory expected to contain the pre-trained PyTorch model weights file (resnet_cleft_model.pth).
-
Clone the repository (or navigate to the project directory).
-
Create a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
Note:
streamlitis required to runapp.py. If it's not installed viarequirements.txt, you may need to install it manually:pip install streamlit
-
Ensure Model Weights are Present: Make sure the pre-trained weights file
resnet_cleft_model.pthis located inside themodel/directory.
To start the Streamlit web server, run the following command in your terminal:
streamlit run app.pyThis will launch the application in your default web browser (usually at http://localhost:8501). You can then upload an image (JPG, JPEG, PNG, or WEBP) and view the model's prediction and confidence score out of 10.