Vikas01 commited on
Commit
0183a47
1 Parent(s): 3bd9fec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -29
app.py CHANGED
@@ -65,37 +65,37 @@ def receive_image(image):
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
- # uname =request.args.get("uname")
74
- # matching =request.args.get("matching")
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
 
 
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