File tree 3 files changed +63
-55
lines changed
3 files changed +63
-55
lines changed Original file line number Diff line number Diff line change 1
1
import flask
2
- from flask import request
2
+ from flask import request , redirect
3
3
from flask_cors import CORS
4
4
import draw_inference
5
5
@@ -12,6 +12,11 @@ def homepage():
12
12
with open ('index.html' ) as f :
13
13
return f .read ()
14
14
15
+ @app .route ('/result/ios.png' , methods = ['GET' ])
16
+ def icon ():
17
+ with open ('result/ios.png' , 'rb' ) as f :
18
+ return f .read ()
19
+
15
20
@app .route ('/' , methods = ['POST' ])
16
21
def upload_img ():
17
22
print (request .files )
@@ -21,4 +26,4 @@ def upload_img():
21
26
22
27
new_path = draw_inference .infrence ('./uploaded_img.dng' , 'ios' )
23
28
print (new_path )
24
- return "ok"
29
+ return redirect ( '/' )
Original file line number Diff line number Diff line change 3
3
< head >
4
4
< meta charset ="UTF-8 ">
5
5
< meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6
- < link rel ="stylesheet " href ="style.css ">
6
+ < link rel ="stylesheet " href ="https://use.fontawesome.com/releases/v5.8.1/css/all.css " integrity ="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf " crossorigin ="anonymous ">
7
+ < style >
8
+ body {
9
+ margin : 0 ;
10
+ }
11
+ .Header {
12
+ text-align : center;
13
+ background : # 2c2b2b ;
14
+ color : # fff ;
15
+ font-weight : bolder;
16
+ font-size : 26px ;
17
+ padding : 10px 0 ;
18
+ width : 100% ;
19
+ margin : 0 ;
20
+ }
21
+
22
+ .fileuploader {
23
+ width : 70px ;
24
+ height : 70px ;
25
+ padding : 32px 0 5px 0 ;
26
+ display : flex;
27
+ margin : 5px auto 0px auto;
28
+ }
29
+ input [type = "file" ] {
30
+ display : none;
31
+ }
32
+ .icon {
33
+ width : 100% ;
34
+ height : auto;
35
+ }
36
+ .upload_tag_line {
37
+ text-align : center;
38
+ margin : 0 ;
39
+ font-size : 25px ;
40
+ }
41
+ .submitbtn {
42
+ background : black;
43
+ color : white;
44
+ padding : 10px ;
45
+ font-weight : 600 ;
46
+ font-size : 15px ;
47
+ border-radius : 5px ;
48
+ width : 100% ;
49
+ position : absolute;
50
+ bottom : 3px ;
51
+ }
52
+
53
+ # uploaded_img {
54
+ width : 80% ;
55
+ display : flex;
56
+ margin : auto;
57
+ }
58
+ </ style >
7
59
< script >
8
60
let dataURL
9
61
57
109
< h2 class ="Header "> Nacto Vision </ h2 >
58
110
< form method ="POST " enctype =multipart/form-data >
59
111
< label for ="upload_img " class ="fileuploader ">
60
- < img src ="./icons/upload-solid.svg " alt ="" class ="icon ">
112
+ <!-- <img src="./icons/upload-solid.svg" alt="" class="icon"> -->
113
+ < i class ="fas fa-upload icon "> </ i >
61
114
< input type ="file " name ="upload_img " id ="upload_img " onchange ="read_file(event) ">
62
115
</ label >
63
116
< p class ="upload_tag_line "> Upload Your Files</ p >
64
117
< div >
65
118
< input type ="submit " class ="submitbtn " value ="Submit ">
66
119
</ div >
67
120
</ form >
68
- < img src ="" alt ="" id ="uploaded_img ">
121
+ < img src ="result/ios.png " alt ="" id ="uploaded_img ">
69
122
</ body >
70
123
</ html >
Original file line number Diff line number Diff line change 1
- body {
2
- margin : 0 ;
3
- }
4
- .Header {
5
- text-align : center;
6
- background : # 2c2b2b ;
7
- color : # fff ;
8
- font-weight : bolder;
9
- font-size : 26px ;
10
- padding : 10px 0 ;
11
- width : 100% ;
12
- margin : 0 ;
13
- }
14
-
15
- .fileuploader {
16
- width : 70px ;
17
- height : 70px ;
18
- padding : 32px 0 5px 0 ;
19
- display : flex;
20
- margin : 5px auto 0px auto;
21
- }
22
- input [type = "file" ] {
23
- display : none;
24
- }
25
- .icon {
26
- width : 100% ;
27
- height : auto;
28
- }
29
- .upload_tag_line {
30
- text-align : center;
31
- margin : 0 ;
32
- font-size : 25px ;
33
- }
34
- .submitbtn {
35
- background : black;
36
- color : white;
37
- padding : 10px ;
38
- font-weight : 600 ;
39
- font-size : 15px ;
40
- border-radius : 5px ;
41
- width : 100% ;
42
- position : absolute;
43
- bottom : 3px ;
44
- }
45
-
46
- # uploaded_img {
47
- width : 80% ;
48
- display : flex;
49
- margin : auto;
50
- }
You can’t perform that action at this time.
0 commit comments