Aniruddha-Tapas/Predicting-Diseases-From-Symptoms

Trying to create a Flask app using the trained model

leanderme opened this issue · 0 comments

Hi,
I've tried to follow along your great work. As one of the open todos is to create a web service, I tried but failed miserably. I haven't understood yet how to predict a disease on a given symptom.

What I have is really just a boilerplate. Could you lead me in the right direction? Any help is greatly appreciated.

from flask import Flask, session, render_template, request
app = Flask(__name__)
import json
from sklearn.naive_bayes import GaussianNB
import numpy as np
import pickle as pkl
from sklearn.externals import joblib

model = joblib.load(open('mnb.pkl'))

@app.route("/", methods = ['POST','GET'])
def main():
    if request.method == 'POST':
        pass

    if 'prediction' in session:
      return render_template('index.html', prediction=session['prediction'])
    return render_template('index.html')

@app.route("/prediction/results", methods = ['POST'])
def predict():
   symptom = float(request.form['symptom'])