Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ import base64
|
|
18 |
import numpy as np
|
19 |
import cv2
|
20 |
import numpy as np
|
21 |
-
|
22 |
##################
|
23 |
|
24 |
|
@@ -33,10 +33,7 @@ socket = SocketIO(app,async_mode="eventlet")
|
|
33 |
|
34 |
######################
|
35 |
|
36 |
-
|
37 |
-
np.set_printoptions(suppress=True)
|
38 |
-
model = load_model(r"keras_model.h5", compile=False)
|
39 |
-
class_names = open(r"labels.txt", "r").readlines()
|
40 |
|
41 |
def base64_to_image(base64_string):
|
42 |
# Extract the base64 encoded binary data from the input string
|
@@ -75,37 +72,7 @@ def receive_image(image):
|
|
75 |
def home():
|
76 |
return render_template("index.html")
|
77 |
|
78 |
-
|
79 |
-
def storedata():
|
80 |
-
# uname =request.form.get("uname")
|
81 |
-
# matching =request.form.get("matching")
|
82 |
-
# rtime =request.form.get("rtime")
|
83 |
-
name =request.args.get("class_name")
|
84 |
-
score =request.args.get("confidence_score")
|
85 |
-
# rtime =request.args.get("rtime")
|
86 |
-
|
87 |
-
con = sqlite3.connect("facedb") # connect database
|
88 |
-
con.row_factory = sqlite3.Row # create object of Row
|
89 |
-
cur = con.cursor() # create cursor object, which will hold records
|
90 |
-
# being fetched from database.
|
91 |
-
cur.execute( "insert into userdata (username , matching , recordingtime) values ('%s',%s,'%s')"%(uname,matching,rtime))
|
92 |
-
#cur.execute("select * from students where email=='%s' and pswd=='%s'"%(useremail,userpswd))
|
93 |
-
con.commit()
|
94 |
-
con.close()
|
95 |
-
|
96 |
-
return redirect(url_for( 'datafetch'))
|
97 |
-
|
98 |
-
@app.route ("/data" )
|
99 |
-
def datafetch():
|
100 |
-
# connect to Sqlite database and fetch data
|
101 |
-
con = sqlite3.connect("facedb") # connect sms database
|
102 |
-
con.row_factory = sqlite3.Row # create object of Row
|
103 |
-
cur = con.cursor() # create cursor object, which will hold records
|
104 |
-
# being fetched from database.
|
105 |
-
cur.execute( "select id, username, matching, recordingtime from userdata order by id desc limit 10") # execute a SQL query to get the data
|
106 |
-
rows = cur.fetchall() # all the data pulled from database is stored in rows object
|
107 |
-
con.close ()
|
108 |
-
return render_template ('data.html', data = rows)
|
109 |
|
110 |
|
111 |
|
|
|
18 |
import numpy as np
|
19 |
import cv2
|
20 |
import numpy as np
|
21 |
+
|
22 |
##################
|
23 |
|
24 |
|
|
|
33 |
|
34 |
######################
|
35 |
|
36 |
+
|
|
|
|
|
|
|
37 |
|
38 |
def base64_to_image(base64_string):
|
39 |
# Extract the base64 encoded binary data from the input string
|
|
|
72 |
def home():
|
73 |
return render_template("index.html")
|
74 |
|
75 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
|
78 |
|