Demo video: https://github.com/bekuretsion/SmartRx-AI-System/blob/main/SMARTTX.mp4
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.
The machine learning model is trained separately before being connected to the Flask web application.
The training process includes the following steps:
-
Collect or load a dataset containing symptoms and their corresponding diseases.
-
Separate the dataset into:
- Features: symptoms
- Labels: diseases
-
Preprocess the data by encoding symptoms into a format suitable for machine learning.
-
Split the dataset into training and testing sets.
-
Train different machine learning models using the training data.
-
Test the models using the testing data to evaluate their performance.
-
Select the best-performing model based on accuracy and reliability.
-
Save the trained model using
pickleorjoblib.
Example:
model.pklThe saved model is later loaded into the Flask application for prediction.
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, andrequest - Importing
pickleto load the saved machine learning model - Importing required libraries such as
numpyandpandasfor 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"))The application contains two main routes.
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.
The prediction route uses the POST method.
When the user submits symptoms through the form, the application performs the following actions:
-
Receives the symptoms from the form input.
-
Preprocesses the symptoms into the same format used during model training.
-
Passes the processed input into the trained machine learning model.
-
Predicts the most likely disease.
-
Retrieves additional information related to the predicted disease, including:
- Disease description
- Precautions
- Recommended medications
- Suggested workouts
- Diet recommendations
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.
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.
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.