Skip to content

Bright136/Embedding-a-Machine-Learning-Model-into-a-Web-Application

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀Embedding-a-Machine-Learning-Model-into-a-Web-Application 🚀

python fastapi Issues PR Open Source Love png1

Project Description

This project combines machine learning and FastAPI to develop a powerful and scalable application for predictive analytics and real-time data processing."

Table of Contents

  1. Overview Of the Project
  1. Application / Deployed Links

  2. Technology Stack

  3. Deliverables

  4. Installation

  5. Execution

  6. API Endpoints

  7. App Usage

  8. Contributing Instructions

  9. Contact Information

1. Overview Of the Project

  • The sepsis prediction project revolves around a machine learning model designed to accurately predict sepsis in intensive care unit (ICU) patients. The model has undergone rigorous training and evaluation to ensure its effectiveness in identifying patients at risk of sepsis.

  • The project provides a comprehensive solution, including a well-documented FastAPI hosted on a platform like the Hugging Face Model Hub and Heroku. This API allows seamless integration of the sepsis prediction model into existing healthcare systems, providing healthcare professionals with valuable insights to improve patient care.

  • To simplify deployment and usage, the project includes a Dockerfile that streamlines the setup process and ensures the necessary dependencies are installed. This enables easy deployment of the sepsis prediction model in various environments, both local and cloud-based.

  • Detailed documentation and practical examples are provided to guide users in effectively utilizing the sepsis prediction model. The documentation covers installation instructions, API usage guidelines, and highlights the potential applications of the model in real-world healthcare scenarios, empowering healthcare providers to make informed decisions and enhance patient outcomes.

i. Description of dataset

Column Name Attribute/Target Description
ID N/A Unique number to represent patient ID
PRG Attribute1 Plasma glucose
PL Attribute 2 Blood Work Result-1 (mu U/ml)
PR Attribute 3 Blood Pressure (mm Hg)
SK Attribute 4 Blood Work Result-2 (mm)
TS Attribute 5 Blood Work Result-3 (mu U/ml)
M11 Attribute 6 Body mass index (weight in kg/(height in m)^2)
BD2 Attribute 7 Blood Work Result-4 (mu U/ml)
Age Attribute 8 Patients age (years)
Insurance N/A If a patient holds a valid insurance card
Sepssis Target Positive: if a patient in ICU will develop sepsis, and Negative: otherwise

2. Application / Deployed Links

API Deployed links
FastApi Sepsis Prediction API-huggingface
FastApi Sepsis Prediction API-heroku
App Deployed links
Sepsis Prediction App Deployed App with huggingface

3. Technology Stack

Technology Version
Python 3.9
FastAPI 0.95.2
Uvicorn 0.22.0
Scikit-learn 0.24.1
Pandas 1.2.4
Jinja2 3.1.2

4. Deliverables

  1. A jupyter notebook for training a classification model
  2. A classification Model
  3. An API App built with FastApi
  4. A Streamlit app that make calls to the build and hosted API
  5. A Dockerfile for easy deployment

5. Installation

Clone the repository to your local machine:

    git clone https://github.com/Bright136/Embedding-a-Machine-Learning-Model-into-a-Web-Application.git

Navigate to the project directory:

    cd Embedding-a-Machine-Learning-Model-into-a-Web-Application

Create a new virtual environment and activate the virtual:

  • Windows:

      python -m venv venv; venv\Scripts\activate; python -m pip install -q --upgrade pip; python -m pip install -qr requirements.txt  
    
  • Linux & MacOs:

      python3 -m venv venv; source venv/bin/activate; python -m pip install -q --upgrade pip; python -m pip install -qr requirements.txt
    

6. Execution

  1. Notebooks

To run any the notebooks:

  • Navigate the project folder on anaconda terminal
  • Run the command 'jupyter notebook'
  • Navigate to the notebook 'Sepssis_prediction_with_ml.ipynb'
  • Run cells in the notebook
  1. API

To execute the API, follow these steps: After all requirement have been install

At the root of your repository in your terminal root :: Embedding-a-Machine-Learning-Model-into-a-Web-Application> ... run the command:

        uvicorn src.app.app:app --reload 

OR

        python src/app/app.py

Open your browser and go to http://127.0.0.1:8000/docs to access the API documentation

  1. Streamlit App

To execute the App, follow these steps: After all requirement have been install

At the root of your repository in your terminal root :: Embedding-a-Machine-Learning-Model-into-a-Web-Application> ... run the command:

        streamlit src/streamlit_app/main.py

Open your browser and go to http://localhost:8501 or http://172.20.10.12:8501 to access the App.

7. Endpoints

  1. /: This Endpoint display a welcome message-” Welcome to the Sepsis API...”.
  2. /health: Checks status of the API
  3. model-info: Returns model information
  4. /predict: Recieve inouts and retuens a single prediction.
  5. /predict-batch: Receives multiples inputs and returns multiple predictions
  6. /upload-data: Receives JSON or CSV file, process it and returns predictions

8. App Usage

To test the various endpoints of the API using the provided documentation, follow these steps:

  1. Start by accessing the API documentation, which provides detailed information about the available endpoints and their functionalities.

  2. Locate the section that describes the input fields and parameters required for each endpoint. It will specify the expected data format, such as JSON or form data, and the necessary input fields.

  3. Enter the required input data into the corresponding input fields or parameters as specified in the documentation.

  4. Send the request by clicking the "Execute" button or using the appropriate method in your chosen tool. The API will process the request and generate the output based on the provided inputs.

  5. Retrieve the response from the API, which will contain the generated output. This output may include predictions, probability scores, or any other relevant information related to sepsis prediction.

  6. Repeat the process to test different endpoints or vary the input data to explore the capabilities of the API. Make sure to follow the documentation's guidelines for each endpoint to ensure accurate results.

9. Contributing Instructions

To contribute to this project, follow these guidelines:

  • Fork the repository.
  • Create a new branch: git checkout -b my-new-feature
  • Make your changes and commit them: git commit -am 'Add some feature'
  • Push to the branch: git push origin my-new-feature
  • Create a new pull request

Screenshot of the API

Document.-.Google.Chrome.2023-06-10.23-09-52.mp4

Screenshots of App

This app makes calls to our API endpoint /predict.

10. Contact Information

Name Twitter LinkedIn GitHub Hugging Face
Bright Eshun @bright_eshun_ @brighteshun @bright136 @bright1

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages