Commit f4d2d0d6 authored by Nikhil Chakka's avatar Nikhil Chakka 💬
Browse files

Update home.html, pra.py files

parents
<!DOCTYPE html>
<html lang="en">
<head>
<style>
container{position:relative;width:10%;max-width:960px;margin:0 auto;padding:0 20px;box-sizing:border-box}
h3 {text-align: center;}
#myDIV {
color: blue;
border: 3px solid currentcolor;
}
.button {
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.button2 {background-color: #008CBA;}
</style>
<h3>HEART DISEASE PREDICTION</h3>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Calculator</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css"
/>
<style>
.alert {
background: green;
padding: 1rem;
border-radius: 5px;
color: white;
margin: 1rem;
}
</style>
<meta charset="UTF-8">
<title>First Flask App</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
</head>
<script>
function myFunction() {
var text1= $('#text1').val();
var text2= $('#text2').val();
var text3= $('#text3').val();
var text4= $('#text4').val();
var text5= $('#text5').val();
var text6= $('#text6').val();
$.ajax({
url: "/join",
type: "POST",
data: {text1:text1,
text2:text2,text3:text3,text4:text4,text5:text5,text6:text6}
}).done(function(response) {
var html= "<br><br><br><p> <b> RESULT : <b><p>";
response =response.result;
$.each(response,function(key,val){
console.log(val);
html+="<p>"+val+"<p>"
});
html +="<br>";
$(".show-data").append(html);
});
};
</script>
<body style="background-color:LightGray;">
<p>
<div id="#myDIV" class="container">
<br><br>
Age<input type="text" id="text1" name="t1" class="u-full-width" placeholder="age"><br><br>
Sex<input type="text" id="text2" class="u-full-width" name="t2" placeholder="sex"><br><br>
Chespain<input type="text" id="text3" class="u-full-width" name="t3" placeholder="chestpain"><br><br>
Trestbps<input type="text" id="text4" class="u-full-width" name="t4" placeholder="trestbps"><br><br>
Chol<input type="text" id="text5" class="u-full-width" name="t5" placeholder="chol"><br><br>
fbs<input type="text" id="text6" class="u-full-width" name="t6" placeholder="fbs"><br><br>
<button id="clicked" class="button button2" onclick="myFunction()">Submit</button>
</p>
<div class="alert">
{{ bill }}
</div>
<div class="show-data" >
</div>
</div>
</body>
</html>
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import os
#print(os.listdir())
import warnings
warnings.filterwarnings('ignore')
dataset = pd.read_csv("heart.csv")
y = dataset["sex"]
sns.countplot(dataset["target"])
#plt.show()
from sklearn.model_selection import train_test_split
predictors = dataset.drop("target",axis=1)
target = dataset["target"]
X_train,X_test,Y_train,Y_test = train_test_split(predictors,target,test_size=0.20,random_state=0)
from sklearn.linear_model import LogisticRegression
lr = LogisticRegression()
lr.fit(X_train,Y_train)
print(lr.score(X_train,Y_train))
y=lr.predict([[1,1,1,1,1,1,0,150,0,2.3,0,0,1]])
print(y)
from flask import Flask, request, render_template,jsonify
app = Flask(__name__)
def do_something(text1,text2,a,b,c,d):
text1 = text1.upper()
text2 = text2.upper()
combine = int(text1) +int(text2)+int(a)+int(b)+int(c)+int(d)
return combine
@app.route('/')
def home():
return render_template('home.html')
@app.route('/join', methods=['GET','POST'])
def my_form_post():
text1 = request.form['text1']
word = request.args.get('text1')
text2 = request.form['text2']
text3 = request.form['text3']
text4 = request.form['text4']
text5 = request.form['text5']
text6 = request.form['text6']
combine = do_something(text1,text2,text3,text4,text5,text6)
result = {
"output": combine
}
#result = {str(key): value for key, value in result.items()}
return jsonify(result=result)
if __name__ == '__main__':
app.run(debug=True)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment