-
Notifications
You must be signed in to change notification settings - Fork 59
/
delete_user.py
28 lines (21 loc) · 846 Bytes
/
delete_user.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os
import pickle
import glob
# deletes a registered user from database
def delete_user():
name = input("Enter name of the user:")
with open("./face_database/embeddings.pickle", "rb") as database:
db = pickle.load(database)
user = db.pop(name, None)
if user is not None:
print('User ' + name + ' deleted successfully')
# save the database
with open('face_database/embeddings.pickle', 'wb') as database:
pickle.dump(db, database, protocol=pickle.HIGHEST_PROTOCOL)
[os.remove(path) for path in glob.glob('./voice_database/' + name + '/*')]
os.removedirs('./voice_database/' + name)
os.remove('./gmm_models/' + name + '.gmm')
else:
print('No such user !!')
if __name__ == '__main__':
delete_user()