-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
91 lines (71 loc) · 1.77 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import pickle
from flask import Flask, request, render_template
import pandas
temperature = pickle.load(open('temperaturepred.pkl','rb'))
humidity = pickle.load(open('humiditypred.pkl', 'rb'))
pressure = pickle.load(open('pressurepred.pkl','rb'))
temp_html = temperature.to_html(classes='table', index=False)
humidity_html = humidity.to_html(classes='table', index=False)
pressure_html = pressure.to_html(classes='table', index=False)
app = Flask(__name__)
@app.route('/')
def index():
with open('templates/output1.html', 'w') as f:
f.write("""
<!DOCTYPE html>
<html>
<head>
<!--<link rel="stylesheet" type="text/css" href="styles.css"> -->
<style>
body {
background-image: url('image1.jpg');
}
.table {
width: 100%;
border-collapse: collapse;
max-width: 750px;
margin: 0px auto;
}
.table th {
background-color: black;
color: aqua;
font-weight: 200;
padding: 10px;
}
.table td {
background-color: lavender;
color: black;
border: 2px solid;
padding: 10px;
}
#table1 {
margin: 20px;
font-size: 20px;
}
#table2 {
margin: 20px;
font-size: 20px;
}
#table3 {
margin: 20px;
font-size: 20px;
}
</style>
</head>
<body>
<div class="container" style="display: flex;
justify-content: center;
margin: 40px 0;">
<img src="image1.jpg" alt="">
""")
f.write(temp_html)
f.write(humidity_html)
f.write(pressure_html)
f.write("""
</div>
</body>
</html>""")
# generate HTML table
return render_template('output1.html')
if __name__ == '__main__':
app.run(debug=True)