-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
60 lines (50 loc) · 1.39 KB
/
app.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
from flask import Flask,render_template,url_for,request,jsonify
from flask_cors import cross_origin
import pandas as pd
import numpy as np
import datetime
import pickle
from FeatureExtraction import predict
app = Flask(__name__,template_folder="templates")
@app.route("/",methods=['GET'])
@cross_origin()
def home():
return render_template("index.html")
@app.route("/about",methods=['GET'])
@cross_origin()
def about():
return render_template("about.html")
@app.route("/blog",methods=['GET'])
@cross_origin()
def Blog():
return render_template("Blog.html")
@app.route("/behindthescenes",methods=['GET'])
@cross_origin()
def bts():
return render_template("services.html")
@app.route("/statistics",methods=['GET'])
@cross_origin()
def statistics():
return render_template("Statistics.html")
@app.route("/detecturl",methods=['GET'])
@cross_origin()
def detecturl():
return render_template("DetectURL.html")
@app.route("/predict",methods=['GET', 'POST'])
@cross_origin()
def prediction():
if request.method == "POST":
url = request.form['url']
try:
status = predict(url)
status = int(status[0])
except:
return render_template("DetectURL.html")
finally:
if status == 0:
return render_template("result.html",leg=status,name=url)
else:
return render_template("result.html",leg=status,name=url)
return render_template("DetectURL.html")
if __name__=='__main__':
app.run(debug=True)