Removed address and added the remove_face template.
This commit is contained in:
parent
4d0d442ab6
commit
744ba93e42
4 changed files with 24 additions and 36 deletions
32
DBHelper.py
32
DBHelper.py
|
@ -37,8 +37,8 @@ def login(email, password):
|
|||
|
||||
|
||||
# Uploads the data of specified user into firebase.
|
||||
def upload_data(user_id, firstname, lastname, email, phone, address):
|
||||
data = {"First Name": firstname, "Last Name": lastname, "E-Mail": email, "Phone": phone, "Address": address}
|
||||
def upload_data(user_id, firstname, lastname, email, phone):
|
||||
data = {"First Name": firstname, "Last Name": lastname, "E-Mail": email, "Phone": phone}
|
||||
db.child("Users").child(user_id).set(data)
|
||||
|
||||
|
||||
|
@ -71,12 +71,6 @@ def get_phone(user_id):
|
|||
return phone
|
||||
|
||||
|
||||
# Returns the address or else an empty string.
|
||||
def get_address(user_id):
|
||||
address = db.child("Users").child(str(user_id)).child("Address").get().val()
|
||||
return address
|
||||
|
||||
|
||||
# Uploads the photos of user, input should be something like "example.jpg"
|
||||
def upload_user_photo(user_id):
|
||||
storage.child("Photos_of_Users/" + user_id).put("Facial_images/face_rec/train/" + user_id)
|
||||
|
@ -141,45 +135,39 @@ def set_power(power):
|
|||
|
||||
|
||||
# Returns the first name or else an empty string.
|
||||
def get_signal_firstname():
|
||||
def get_register_firstname():
|
||||
firstname = db.child("signal").child("2").child("First Name").get().val()
|
||||
return firstname
|
||||
|
||||
|
||||
# Returns the last name or else an empty string.
|
||||
def get_signal_lastname():
|
||||
def get_register_lastname():
|
||||
lastname = db.child("signal").child("2").child("Last Name").get().val()
|
||||
return lastname
|
||||
|
||||
|
||||
# Returns the e-mail or else an empty string.
|
||||
def get_signal_email():
|
||||
def get_register_email():
|
||||
email = db.child("signal").child("2").child("E-Mail").get().val()
|
||||
return email
|
||||
|
||||
|
||||
# Returns the phone or else an empty string.
|
||||
def get_signal_phone():
|
||||
def get_register_phone():
|
||||
phone = db.child("signal").child("2").child("Phone").get().val()
|
||||
return phone
|
||||
|
||||
|
||||
# Returns the address or else an empty string.
|
||||
def get_signal_address():
|
||||
address = db.child("signal").child("2").child("Address").get().val()
|
||||
return address
|
||||
|
||||
|
||||
# Uploads the data of user input into firebase.
|
||||
def upload_signal_data(firstname, lastname, email, phone, address):
|
||||
data = {"First Name": firstname, "Last Name": lastname, "E-Mail": email, "Phone": phone, "Address": address}
|
||||
def upload_register_data(firstname, lastname, email, phone):
|
||||
data = {"First Name": firstname, "Last Name": lastname, "E-Mail": email, "Phone": phone}
|
||||
db.child("signal").child("2").set(data)
|
||||
|
||||
|
||||
# Removes the inputs.
|
||||
def reset_data():
|
||||
def remove_register_data():
|
||||
db.child("signal").child("2").remove()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
upload_signal_data("RandomFirst", "RandomLast", "Random@gmail.com", "0000000000", "Random Address")
|
||||
upload_register_data("RandomFirst", "RandomLast", "Random@gmail.com", "0000000000")
|
||||
|
|
16
Main.py
16
Main.py
|
@ -8,12 +8,10 @@ if __name__ == "__main__":
|
|||
if DBHelper.get_power() == "on":
|
||||
Start_Engine.start()
|
||||
|
||||
if None not in (DBHelper.get_signal_firstname(),
|
||||
DBHelper.get_signal_lastname(),
|
||||
DBHelper.get_signal_email(),
|
||||
DBHelper.get_signal_phone(),
|
||||
DBHelper.get_signal_address()):
|
||||
Upload_Face.upload_your_face(DBHelper.get_signal_firstname(), DBHelper.get_signal_lastname(),
|
||||
DBHelper.get_signal_email(), DBHelper.get_signal_phone(),
|
||||
DBHelper.get_signal_address())
|
||||
DBHelper.reset_data()
|
||||
if None not in (DBHelper.get_register_firstname(),
|
||||
DBHelper.get_register_lastname(),
|
||||
DBHelper.get_register_email(),
|
||||
DBHelper.get_register_phone()):
|
||||
Upload_Face.upload_your_face(DBHelper.get_register_firstname(), DBHelper.get_register_lastname(),
|
||||
DBHelper.get_register_email(), DBHelper.get_register_phone())
|
||||
DBHelper.remove_register_data()
|
||||
|
|
3
Remove_Face.py
Normal file
3
Remove_Face.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
import DBHelper
|
||||
|
||||
def remove_your_face(firstname, lastname, email, phone):
|
|
@ -2,7 +2,7 @@ import DBHelper
|
|||
import Facial_Recognition_Registration
|
||||
|
||||
|
||||
def upload_your_face(firstname, lastname, email, phone, address):
|
||||
def upload_your_face(firstname, lastname, email, phone):
|
||||
# Determines user ID before adding the data to the database.
|
||||
# User ID is determined from number of user dataset in database
|
||||
# Later on it starts face recognition system and uploads it into the database based on the given user ID.
|
||||
|
@ -11,12 +11,12 @@ def upload_your_face(firstname, lastname, email, phone, address):
|
|||
count = 1
|
||||
for user in users.each():
|
||||
count += 1
|
||||
DBHelper.upload_data("User_" + str(count), firstname, lastname, email, phone, address)
|
||||
DBHelper.upload_data("User_" + str(count), firstname, lastname, email, phone)
|
||||
Facial_Recognition_Registration.register_your_face("User_" + str(count))
|
||||
for i in range(20):
|
||||
DBHelper.upload_user_photo("User_" + str(count) + "/" + str(i) + ".jpg")
|
||||
except:
|
||||
DBHelper.upload_data("User_1", firstname, lastname, email, phone, address)
|
||||
DBHelper.upload_data("User_1", firstname, lastname, email, phone)
|
||||
Facial_Recognition_Registration.register_your_face("User_1")
|
||||
for i in range(20):
|
||||
DBHelper.upload_user_photo("User_1/" + str(i) + ".jpg")
|
||||
|
@ -27,5 +27,4 @@ if __name__ == "__main__":
|
|||
l = input('Enter your Last Name:')
|
||||
e = input('Enter your E-Mail:')
|
||||
p = input('Enter your Phone:')
|
||||
a = input('Enter your Address:')
|
||||
upload_your_face(f, l, e, p, a)
|
||||
upload_your_face(f, l, e, p)
|
||||
|
|
Loading…
Reference in a new issue