This project implements a Support Vector Machine (SVM) model to predict diabetes using the Pima Indians Diabetes Dataset. It's deployed as a Streamlit web app allowing users to interact and get predictions directly.
This project requires the following Python libraries:
- pandas (used for data manipulation in the original script, not required for the web app)
- numpy
- scikit-learn (used for the loaded model, not required for running the web app)
- pickle (used to load the saved model)
- streamlit
You can install them using pip:
pip install numpy scikit-learn pickle streamlit
Make sure you have a saved model file named 'trained_model.sav' in the 'C:/DeployML/' directory. This file is generated by the original Python script (not included here).
- Clone this repository.
- Open a terminal or command prompt and navigate to the project directory.
- Run the script using Python:
streamlit run app.py
This will launch the web app in your web browser, typically at http://localhost:8501.
The web app provides a user-friendly interface for diabetes prediction. Enter the following details:
- Number of pregnancies
- Glucose level
- Blood pressure level
- Skin-thickness
- Insulin level
- BMI
- Diabetes Pedigree Function
- Age
Click the "Click for Diabetes Test Result" button to receive a prediction ("This person is non-diabetic" or "This person is diabetic").
The original Python script for model building and evaluation is not included here. This README focuses on the Streamlit web app (app.py
) which performs the following:
- Loads the saved model: The
pickle
library is used to load the pre-trained SVM model from the 'trained_model.sav' file. - Defines a prediction function (
diabetes_pred
): This function takes user input as a list, converts it to a NumPy array, reshapes it for prediction, and uses the loaded model to predict the class (diabetic or non-diabetic). - Main function (
main
):- Sets the web app title ("Women Diabetes Prediction Web App").
- Creates text input fields for each user input parameter.
- Defines a button to trigger the prediction.
- When the button is clicked, it calls the
diabetes_pred
function with user input and displays the prediction result as a success message.
- This web app utilizes a pre-trained model. The model building and evaluation process is not included.
- Ensure you have the 'trained_model.sav' file in the specified location.
- This is a basic implementation, and exploring different SVM kernels or feature engineering techniques might improve performance.