forked from siddas27/license-plate-recognition
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
36 lines (28 loc) · 883 Bytes
/
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
import os
from flask import Flask, render_template, request
from lprecognition1 import getdata
app = Flask(__name__)
APP_ROOT = os.path.dirname(os.path.abspath(__file__))
@app.route("/")
def main():
return render_template('index.html')
@app.route('/uploader', methods = ['POST'])
def upload_file():
target = os.path.join(APP_ROOT, 'static/')
print(target)
if not os.path.isdir(target):
os.mkdir(target)
for file in request.files.getlist("file"):
print(file)
filename = file.filename
destination = "/".join([target, filename])
print(destination)
file.save(destination)
#a = getdata(filename)
return render_template("index.html")
@app.route("/<name>")
def get(name):
d = getdata(name)
return render_template("data.html", name = d)
if __name__ == '__main__':
app.run(host = 'localhost', port = 5000)