LovnishVerma commited on
Commit
aa7a3b1
·
verified ·
1 Parent(s): 0af8b9f

Upload 6 files

Browse files
app.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, render_template, request
2
+ import datetime
3
+ import pytz
4
+ import joblib
5
+ app = Flask(__name__)
6
+
7
+
8
+
9
+ @app.route('/')
10
+ def index():
11
+ return render_template('index.html')
12
+
13
+
14
+ @app.route('/predictionpage')
15
+ def pp():
16
+ return render_template('prediction.html')
17
+
18
+
19
+
20
+ @app.route('/prediction', methods=['POST', 'GET'])
21
+ def prediction():
22
+ sl = float(request.form['sl'])
23
+ sw = float(request.form['sw'])
24
+ pl = float(request.form['pl'])
25
+ pw = float(request.form['pw'])
26
+ model = joblib.load('irismodel1.joblib')
27
+ pred = model.predict([[sl, sw, pl, pw]])[0]
28
+ return render_template('prediction.html', pred=pred)
29
+
30
+ @app.route('/add')
31
+ def add():
32
+ return render_template('add.html')
33
+
34
+
35
+ @app.route('/addkaro', methods=['GET'])
36
+ def addkaro():
37
+ a = int(request.args.get('phelanumber'))
38
+ b = int(request.args.get('dusranumber'))
39
+ c = a + b
40
+ o = 'The Sum is'
41
+ return render_template('add.html', c=c, o=o)
42
+
43
+ @app.route('/date')
44
+ def date():
45
+ date=datetime.datetime.now().astimezone(pytz.timezone('Asia/Kolkata')).strftime('%Y-%m-%d %H:%M %p')
46
+ return render_template('datetime.html', current_time=date)
47
+
48
+ if __name__ == '__main__':
49
+ app.run(debug=True)
irismodel1.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0f76b3d9f823faed9b1cb0d1c0e732ae57a71a2ac598957a4736020b9ae17a75
3
+ size 1407
templates/add.html ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+
3
+ <head>
4
+ <title>My Flask App</title>
5
+ </head>
6
+ <body>
7
+ <h1>Welcome to My Flask App!</h1>
8
+ <p>This is the add page.</p> <br>
9
+ <br>
10
+ <a href="/date">Go to Date Page</a> <br>
11
+
12
+ <br>
13
+
14
+ <form action="/addkaro" method="get">
15
+ <input type="number" name="phelanumber" placeholder="Enter first number" required>
16
+ <input type="number" name="dusranumber" placeholder="Enter second number" required>
17
+ <button type="submit">Add</button>
18
+
19
+ </form>
20
+
21
+ {% if c is defined %}
22
+ <b style="color: blue;">{{o}}: {{c}}</b>
23
+ {% endif %}
24
+ </body>
25
+
26
+
27
+ </html>
templates/datetime.html ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+
3
+ <head>
4
+ <title>My Flask App</title>
5
+ </head>
6
+ <body>
7
+ <h1>Current Date and Time</h1>
8
+ <p>The current date and time is: {{ current_time }}</p>
9
+ <br>
10
+ <a href="/">Go to Back to homepage</a> <br>
11
+
12
+ <br>
13
+
14
+ </body>
15
+
16
+
17
+ </html>
templates/index.html ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+
3
+ <head>
4
+ <title>My Homepage</title>
5
+
6
+ </head>
7
+ <body>
8
+
9
+ <h1>Welcome to My Flask App!</h1>
10
+ <p>This is the home page.</p> <br>
11
+
12
+ <a href="/predictionpage">Go to Prediction Page</a> <br>
13
+ <a href="/date">Go to Date Page</a> <br>
14
+ <a href="/add">Go to Add Page</a> <br>
15
+ <br>
16
+ </body>
17
+ </html>
templates/prediction.html ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+
3
+ <head>
4
+ <title>Iris Flower predtion form</title>
5
+
6
+ </head>
7
+
8
+
9
+ <body>
10
+
11
+
12
+ <form action="/prediction" method="post">
13
+ <input type="number" name="sl" placeholder="Enter sepal length" required> <br>
14
+ <input type="number" name="sw" placeholder="Enter sepal width" required> <br>
15
+ <input type="number" name="pl" placeholder="Enter petal length" required> <br>
16
+ <input type="number" name="pw" placeholder="Enter petal width" required> <br>
17
+ <button type="submit">Predict</button>
18
+ </form>
19
+
20
+ {% if pred is defined %}
21
+ <b style="color: blue;">{{pred}}</b>
22
+ {% endif %}
23
+
24
+
25
+ <br>
26
+ <a href="/">Go to Back to homepage</a> <br>
27
+ <br>
28
+
29
+ </body>
30
+ </html>