<jupyter_start><jupyter_text>**Celebrity recognition**  A model to recognize celebrities in images. Works using a MTCNN face detector to detect faces, and VGGFace for creating encodings. These encodings are matched using a libray called annoy (from spotify). Model is created using a dataset of around 6K images for 60 celebrities (mostly Indian). Please upload an image to find the closest celebrity matches.<jupyter_code>im = cv2.imread('celeb_images/dp_output.png')
im = imutils.resize(im, width=400)
im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
im = Image.fromarray(im)
display(im)
btn_run = widgets.Button(description='Identify celeb')
lbl_pred = widgets.Label()
out_pl = widgets.Output()
def on_click_classify(change):
    img = cv2.imdecode(np.frombuffer(btn_upload.data[-1], np.uint8), -1)
    pred, img = get_celeb_prediction_new_1(img)
    img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
    im_pil = Image.fromarray(img)
    out_pl.clear_output()
    with out_pl: display(im_pil)
    celebs = [c["celeb_name"] for c in pred]
    lbl_pred.value = 'Prediction: {}'.format(celebs)

btn_run.on_click(on_click_classify)
btn_upload = widgets.FileUpload(multiple=False)
widgets.VBox([btn_upload, btn_run, out_pl, lbl_pred])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10897435897435898, 'fraction_numerical': 0.014423076923076924, 'mean_word_length': 5.6436170212765955, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '445370', 'license': 'MIT', 'n_tokens_mistral': 458, 'n_tokens_neox': 443, 'n_words': 110, 'path': 'celeb_recognition.ipynb', 'repo_name': 'shobhit9618/celeb_recognition', 'size': '1248'}