Skip to content

Commit c7cd576

Browse files
committed
increase upload bandwidth and render html with template generator
1 parent 2b414f0 commit c7cd576

File tree

6 files changed

+276
-116
lines changed

6 files changed

+276
-116
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,6 @@ ENV/
100100

101101
# mypy
102102
.mypy_cache/
103-
.gitignore/
103+
.gitignore
104+
.idea/*
105+

.idea/workspace.xml

+244-82
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webService/app/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# create app
99
app = Flask(__name__)
1010
CORS(app)
11-
app.config['MAX_CONTENT_LENGTH'] = 3 * 1024 * 1024
11+
app.config['MAX_CONTENT_LENGTH'] = 10 * 1024 * 1024
1212
app.config.from_object(settings)
1313

1414
# register blueprints/modules
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!doctype html>
2+
<title>Compare</title>
3+
<head>
4+
<style>
5+
#main {
6+
width: 600px;
7+
height: 300px;
8+
border: 1px solid #c3c3c3;
9+
10+
}
11+
#main div {
12+
display: inline-block;
13+
width: 400px;
14+
margin: 20px;
15+
}
16+
#main b {
17+
margin: 0 10px 0 0;
18+
}
19+
</style>
20+
</head>
21+
<h1>Upload Pictures to Compare</h1>
22+
<form method=post enctype=multipart/form-data id=main>
23+
<div><b>known image:</b><input type=file name=file1></div>
24+
<div><b>unknown image:</b><input type=file name=file2></div>
25+
<div><input type=submit value=process></div>
26+
</form>

webService/app/module_one/views.py

+2-29
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
from flask import Blueprint
33
import face_recognition
4-
from flask import request, redirect, jsonify
4+
from flask import request, redirect, jsonify, render_template
55

66
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg'}
77

@@ -33,34 +33,7 @@ def compare():
3333
if file and allowed_file(file.filename) and allowed_file(file2.filename):
3434
return process_images(file, file2)
3535

36-
return '''
37-
<!doctype html>
38-
<title>Compare</title>
39-
<head>
40-
<style>
41-
#main {
42-
width: 600px;
43-
height: 300px;
44-
border: 1px solid #c3c3c3;
45-
46-
}
47-
#main div {
48-
display: inline-block;
49-
width: 400px;
50-
margin: 20px;
51-
}
52-
#main b {
53-
margin: 0 10px 0 0;
54-
}
55-
</style>
56-
</head>
57-
<h1>Upload Pictures to Compare</h1>
58-
<form method=post enctype=multipart/form-data id=main>
59-
<div><b>known image:</b><input type=file name=file1></div>
60-
<div><b>unknown image:</b><input type=file name=file2></div>
61-
<div><input type=submit value=process></div>
62-
</form>
63-
'''
36+
return render_template("view.html")
6437

6538

6639
def allowed_file(filename):

webcam/upload.py

-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import os
21
import face_recognition
32
from flask import Flask, request, redirect, jsonify
43

5-
UPLOAD_FOLDER = os.path.abspath("images/")
64
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg'}
75

86
app = Flask(__name__)
9-
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
107
app.config['MAX_CONTENT_LENGTH'] = 3 * 1024 * 1024
118

129

0 commit comments

Comments
 (0)