This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import base64 | |
| from cryptography.hazmat.backends import default_backend | |
| from cryptography.hazmat.primitives import hashes | |
| from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC | |
| from cryptography.fernet import Fernet | |
| def encrypt_text(text, salt): | |
| def generate_key(master, salt): | |
| kdf = PBKDF2HMAC( | |
| algorithm=hashes.SHA512(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cv2 | |
| import face_recognition | |
| import base64 | |
| import io | |
| import os | |
| import numpy as np | |
| from imageio import imread | |
| def get_face_encoding(image): | |
| face_encoding = face_recognition.face_encodings(image)[0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import googletrans | |
| text = input("Enter a sentence: ").lower() | |
| dest = input("Enter a destination language: ").lower() | |
| translator = googletrans.Translator() | |
| language_map = dict((v.lower(), k) for k, v in googletrans.LANGUAGES.items()) | |
| translated_text = translator.translate(text, dest=language_map[dest]) | |
| print(translated_text.text) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from PIL import Image | |
| img = Image.open("pic.png") | |
| img = img.convert("RGBA") | |
| pixel_data = img.load() | |
| width, height = img.size | |
| for y in range(height): | |
| for x in range(width): |
NewerOlder