Update app.py
Browse files
app.py
CHANGED
@@ -42,23 +42,14 @@ def face_detector(image):
|
|
42 |
|
43 |
def searchAll(img):
|
44 |
sol = []
|
45 |
-
for (i,face) in enumerate(face_detector(img)):
|
46 |
-
print("Cara " + str(i))
|
47 |
sol = sol + search(face)
|
48 |
-
print("Hay imagenes: " + str(len(search(face))))
|
49 |
-
print("Imagenes totales: " + str(len(sol)))
|
50 |
return sol
|
51 |
|
52 |
# Definimos una función que se encarga de llevar a cabo cada búsqueda
|
53 |
def search(img, dist=10):
|
54 |
queryHash = convert_hash(dhash(img))
|
55 |
treeResults = sorted(tree.get_all_in_range(queryHash, dist))
|
56 |
-
|
57 |
-
for (d, h) in treeResults:
|
58 |
-
print(hashes.get(h, [])[9:])
|
59 |
-
print(os.path.exists(hashes.get(h, [])[9:]))
|
60 |
-
print(Image.open(hashes.get(h, [])[9:]))
|
61 |
-
|
62 |
return [Image.open(hashes.get(h, [])[9:]) for (d, h) in treeResults]
|
63 |
|
64 |
# Creamos la interfaz y la lanzamos.
|
|
|
42 |
|
43 |
def searchAll(img):
|
44 |
sol = []
|
45 |
+
for (i, face) in enumerate(face_detector(img)):
|
|
|
46 |
sol = sol + search(face)
|
|
|
|
|
47 |
return sol
|
48 |
|
49 |
# Definimos una función que se encarga de llevar a cabo cada búsqueda
|
50 |
def search(img, dist=10):
|
51 |
queryHash = convert_hash(dhash(img))
|
52 |
treeResults = sorted(tree.get_all_in_range(queryHash, dist))
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
return [Image.open(hashes.get(h, [])[9:]) for (d, h) in treeResults]
|
54 |
|
55 |
# Creamos la interfaz y la lanzamos.
|