Skip to content

Repository files navigation

SmartRx AI System – Disease Prediction Web Application

Demo video: https://github.com/bekuretsion/SmartRx-AI-System/blob/main/SMARTTX.mp4

Project Overview

SmartRx AI System is a machine learning-based web application designed to predict possible diseases based on symptoms entered by the user. The system uses a trained machine learning model to analyze symptom inputs and return a predicted disease, along with useful health-related information such as disease descriptions, precautions, medications, workouts, and diet recommendations.

System Workflow

1. Training Phase

The machine learning model is trained separately before being connected to the Flask web application.

The training process includes the following steps:

  1. Collect or load a dataset containing symptoms and their corresponding diseases.

  2. Separate the dataset into:

    • Features: symptoms
    • Labels: diseases
  3. Preprocess the data by encoding symptoms into a format suitable for machine learning.

  4. Split the dataset into training and testing sets.

  5. Train different machine learning models using the training data.

  6. Test the models using the testing data to evaluate their performance.

  7. Select the best-performing model based on accuracy and reliability.

  8. Save the trained model using pickle or joblib.

Example:

model.pkl

The saved model is later loaded into the Flask application for prediction.


2. Flask Application Phase

After the model has been trained and saved, the Flask web application is created to allow users to interact with the system through a web interface.

The Flask application includes:

  • Importing Flask modules such as Flask, render_template, and request
  • Importing pickle to load the saved machine learning model
  • Importing required libraries such as numpy and pandas for input preprocessing
  • Initializing the Flask application
  • Creating routes for the homepage and prediction system
  • Loading the saved machine learning model

Example:

app = Flask(__name__)
model = pickle.load(open("model.pkl", "rb"))

3. Route Definition

The application contains two main routes.

3.1 Homepage Route

The homepage route uses the GET method to display the main web page.

This page contains a form where users can enter their symptoms.

The system renders an HTML template that allows users to submit symptom information.

3.2 Prediction Route

The prediction route uses the POST method.

When the user submits symptoms through the form, the application performs the following actions:

  1. Receives the symptoms from the form input.

  2. Preprocesses the symptoms into the same format used during model training.

  3. Passes the processed input into the trained machine learning model.

  4. Predicts the most likely disease.

  5. Retrieves additional information related to the predicted disease, including:

    • Disease description
    • Precautions
    • Recommended medications
    • Suggested workouts
    • Diet recommendations

4. Returning Results to the User

After the prediction is completed, the system sends the results back to the frontend.

The user can then view:

  • The predicted disease
  • A short description of the disease
  • Important precautions
  • Recommended medications
  • Suggested workouts
  • Suitable diet recommendations

This makes the application more useful because it does not only predict a disease, but also provides helpful guidance related to the prediction.


5. Running the Flask Server

Finally, the Flask server is started so users can access and interact with the web application.

Example:

if __name__ == "__main__":
    app.run(debug=True)

Once the server is running, users can open the application in a browser, enter their symptoms, and receive prediction results instantly.

Summary

SmartRx AI System combines machine learning and Flask to create an intelligent disease prediction web application. The system takes symptoms as input, predicts a possible disease, and displays detailed supporting information such as descriptions, precautions, medications, workouts, and diets. This makes the project practical, interactive, and helpful for users who want quick health-related guidance.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages