Пример #1
0
 def setUp(self):
     self.app = create_app('testing')
     self.app_context = self.app.app_context()
     self.app_context.push()
     db.create_all()
     Role.insert_roles()
     self.client = self.app.test_client(use_cookies=True)
Пример #2
0
 def setUp(self):
     self.app = create_app('testing')
     self.app_context = self.app.app_context()
     self.app_context.push()
     db.create_all()
Пример #3
0
 def setUp(self):
     db.create_all()
     db.session.commit()
Пример #4
0
def init():
    db.create_all()
Пример #5
0
from flask import render_template, url_for, flash, redirect
from app1 import app, db
from app1.forms import RegistrationForm
from app1.models import User
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split  # Importing the necessary libraries
from sklearn.neighbors import KNeighborsClassifier
import pandas as pd
import numpy as np

db.create_all()


@app.route("/", methods=['GET', 'POST'])
def register():
    form = RegistrationForm()
    if form.validate_on_submit():
        # user = User(oxygen_concentration=form.oxygen_concentration.data, dry_cough=form.dry_cough.data,
        #  septic_shock=form.septic_shock.data, age=form.age.data, breathe_rate=form.breathe_rate.data,
        # prior_disease=form.prior_disease.data)
        dataset = pd.read_csv(
            'C:\ProgramFiles\JetBrains\PyCharmCommunityEdition2019.3.3\Covid19_Final_dataset.csv'
        )
        # Reading the covid-19 dataset using pandas
        # print(dataset.head())
        dataset = dataset.replace([np.inf, -np.inf], np.nan).dropna(axis=0)
        # Cleaning the dataset to increase the performance
        septic_shock = LabelEncoder()
        dry_cough = LabelEncoder()  # Labelling the string data as integers
        prior_disease = LabelEncoder()
        dataset['Septic_Shock'] = septic_shock.fit_transform(