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

3 stars 0 forks source link

🚀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

  2. Application / Deployed Links

  3. Technology Stack

  4. Deliverables

  5. Installation

  6. Execution

  7. API Endpoints

  8. App Usage

  9. Contributing Instructions

  10. Contact Information

1. Overview Of the Project

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:

6. Execution

  1. Notebooks

To run any the notebooks:

  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:

Screenshot of the API

https://github.com/Bright136/Embedding-a-Machine-Learning-Model-into-a-Web-Application/assets/94003056/6d544350-61f9-4b26-aff9-33e57e7242ee

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