Beispiel #1
0
from flask import Flask, render_template

# App
from configure import app

# MongoDB
from pymongo import MongoClient
client = MongoClient()
db = client.flashcards

# Endpoints
from endpoints import signup_endpoints

app.register_blueprint(signup_endpoints.endpoints)


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


if __name__ == "__main__":
    app.run()
Beispiel #2
0
        doctor_list[0]['street'].replace(
            ' ', '+') + '+' + doctor_list[0]['city']
    message = 'Here is the nearest doctor who covers your insurance network.\nBio: {} \nPhone Number: {} \nAddress: {} \nGoogle Map: {}'.format(
        doctor_list[0]['bio'], doctor_list[0]['phone'],
        doctor_list[0]['street'] + ', ' + doctor_list[0]['name'], google_map)
    res = {"user_id": "2", "bot_id": "1", "module_id": "3", "message": message}
    return jsonify(res)


def calculate_hr(heart_rates):
    total = 0
    for heart_rate in heart_rates['dataset']:
        total += heart_rate['value']
    avg = total / len(heart_rates['dataset'])
    return round(avg, 2)


def getVisitType(req):
    if req['stroke_probability'] < 0.20:
        return "Heart Healthy"
    elif req['stroke_probability'] >= 0.20 and req['stroke_probability'] < 0.4:
        return "Primary Care"
    elif req['stroke_probability'] >= 0.4 and req['stroke_probability'] < 0.7:
        return "Urgent Care"
    else:
        return "Emergency Room"


if __name__ == "__main__":
    app.run(host="127.0.0.1", port=int("8080"), debug=True)
Beispiel #3
0
def revisedtop_k():

    print("request.get_json() >>>>>> ", (request.get_json(force=True)))
    white_list = request.get_json(force=True)
    print(white_list['revisedtop_k'])
    ans = mitAI_predEng.train_model(white_list['revisedtop_k'], True)
    print("top Features sorted by importance", ans)
    return jsonify(ans)


@app.route('/top-k', methods=['POST'])
def top_k():

    white_list = []
    ans = mitAI_predEng.train_model(white_list, True)
    print("top Features sorted by importance", ans)
    return jsonify(ans)


def pred_accuracy(top_k_features):

    white_list = top_k_features
    pred_accuracy = mitAI_predEng.train_model(white_list, False)
    print("pred_accuracy", pred_accuracy)

    return pred_accuracy


if __name__ == "__main__":
    app.run(host="0.0.0.0", port=int("8080"), debug=True)