Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -65,37 +65,37 @@ def receive_image(image):
|
|
65 |
def home():
|
66 |
return render_template("index.html")
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
#
|
71 |
-
#
|
72 |
-
#
|
73 |
-
|
74 |
-
|
75 |
-
#
|
76 |
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
#
|
81 |
-
|
82 |
-
#
|
83 |
-
|
84 |
-
|
85 |
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
#
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
#
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
|
100 |
|
101 |
|
|
|
65 |
def home():
|
66 |
return render_template("index.html")
|
67 |
|
68 |
+
@app.route ("/storedata" , methods =[ 'GET' ] )
|
69 |
+
def storedata():
|
70 |
+
# uname =request.form.get("uname")
|
71 |
+
# matching =request.form.get("matching")
|
72 |
+
# rtime =request.form.get("rtime")
|
73 |
+
name =request.args.get("class_name")
|
74 |
+
score =request.args.get("confidence_score")
|
75 |
+
# rtime =request.args.get("rtime")
|
76 |
|
77 |
+
con = sqlite3.connect("facedb") # connect database
|
78 |
+
con.row_factory = sqlite3.Row # create object of Row
|
79 |
+
cur = con.cursor() # create cursor object, which will hold records
|
80 |
+
# being fetched from database.
|
81 |
+
cur.execute( "insert into userdata (username , matching , recordingtime) values ('%s',%s,'%s')"%(uname,matching,rtime))
|
82 |
+
#cur.execute("select * from students where email=='%s' and pswd=='%s'"%(useremail,userpswd))
|
83 |
+
con.commit()
|
84 |
+
con.close()
|
85 |
|
86 |
+
return redirect(url_for( 'datafetch'))
|
87 |
+
|
88 |
+
@app.route ("/data" )
|
89 |
+
def datafetch():
|
90 |
+
# connect to Sqlite database and fetch data
|
91 |
+
con = sqlite3.connect("facedb") # connect sms database
|
92 |
+
con.row_factory = sqlite3.Row # create object of Row
|
93 |
+
cur = con.cursor() # create cursor object, which will hold records
|
94 |
+
# being fetched from database.
|
95 |
+
cur.execute( "select id, username, matching, recordingtime from userdata order by id desc limit 10") # execute a SQL query to get the data
|
96 |
+
rows = cur.fetchall() # all the data pulled from database is stored in rows object
|
97 |
+
con.close ()
|
98 |
+
return render_template ('data.html', data = rows)
|
99 |
|
100 |
|
101 |
|