Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions Domains/AI-ML/MiniProjects/disease-predictor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
**Contributor:** shravanidorle

# Disease Predictor Web Service

## 🩺 Project Overview

This is a simple Flask-based web service that utilizes a pre-trained machine learning model to predict a disease based on a list of symptoms provided by the user. It provides both a simple web interface (assuming the necessary templates exist) and a dedicated API endpoint for programmatic access.

---

## ✨ Features

- **RESTful API Endpoint:** A dedicated `/predict` endpoint for JSON-based predictions.
- **Machine Learning Integration:** Uses `joblib` to load and utilize a pre-trained model.
- **Web Interface:** Serves simple front-end pages (`/`, `/about`, `/services`) using Flask templating (requires `index.html`, `about.html`, and `services.html`).

---

## 🛠️ Prerequisites

Before running the application, ensure you have the following installed:

- **Python 3.x**
- **Flask**
- **joblib**

---

## 🚀 Setup and Installation

### 1. File Structure

Your project directory should be structured as follows:

disease-predictor/ ├── app.py ├── disease_predictor_model_5000.pkl <-- Your trained model file (REQUIRED) ├── templates/ │ ├── index.html <-- Home page template (REQUIRED) │ ├── about.html <-- About page template (REQUIRED) │ └── services.html <-- Services page template (REQUIRED) └── README.md

### 2. Install Dependencies

You can install the required Python packages using `pip`:

```bash
pip install Flask joblib

```
27 changes: 27 additions & 0 deletions Domains/AI-ML/MiniProjects/disease-predictor/app_5000.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from flask import Flask, request, jsonify, render_template
import joblib

app = Flask(__name__)
model = joblib.load('disease_predictor_model_5000.pkl')

@app.route('/')
def home():
return render_template('index.html')

@app.route('/about')
def about():
return render_template('about.html')

@app.route('/services')
def services():
return render_template('services.html')

@app.route('/predict', methods=['POST'])
def predict():
data = request.json
symptoms = data.get('symptoms', '')
prediction = model.predict([symptoms])
return jsonify({'disease': prediction[0]})

if __name__ == '__main__':
app.run(debug=True)
Binary file not shown.
Loading
Loading