|
import numpy as np |
|
from deepface import DeepFace |
|
import gradio as gr |
|
|
|
|
|
def save_identity(image , name): |
|
try: |
|
embeddings = DeepFace.represent(image , model_name="Facenet") |
|
return str(embeddings) |
|
except Exception as error: |
|
return str(error) |
|
|
|
|
|
|
|
label_output = gr.outputs.Textbox() |
|
|
|
|
|
|
|
|
|
|
|
|
|
image_input = gr.inputs.Image(shape=(160, 160)) |
|
label_input = gr.inputs.Textbox(label="Enter Label") |
|
output_image = gr.outputs.Image(type="numpy") |
|
|
|
|
|
interface = gr.Interface( |
|
fn=save_identity, |
|
inputs=[image_input, label_input], |
|
outputs=label_output, |
|
title="Face Identification", |
|
description="Upload an image, enter a label, and get the output image.", |
|
) |
|
|
|
|
|
interface.launch() |
|
|