Skip to content

Commit

Permalink
updated code to recalculate embeddings
Browse files Browse the repository at this point in the history
  • Loading branch information
devansh-shah-11 committed Jul 30, 2024
1 parent 1b7c685 commit 02bd51e
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions API/route.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

collection = 'faceEntries'
collection2 = 'ImageDB'

collection3 = 'VectorDB'

# Models for the data to be sent and received by the server
class Employee(BaseModel):
Expand Down Expand Up @@ -112,14 +112,11 @@ async def recalculate_embeddings():
if 'Images' in employee:
images = employee['Images']
else:
images = employee['Image']
images = [employee['Image']]

for encoded_image in images:
encoded_image = encoded_image.replace('data:image/png;base64,', '')
encoded_image = encoded_image.strip()
encoded_image += '=' * (-len(encoded_image) % 4)
img_recovered = base64.b64decode(encoded_image)
pil_image = Image.open(BytesIO(img_recovered))

pil_image = Image.open(BytesIO(base64.b64decode(encoded_image)))
image_filename = f'{employee["Name"]}.png'
pil_image.save(image_filename)
logging.debug(f'Image saved {employee["Name"]}')

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This expression logs
sensitive data (private)
as clear text.
This expression logs
sensitive data (private)
as clear text.
Expand Down

0 comments on commit 02bd51e

Please sign in to comment.