Commit
·
500f010
1
Parent(s):
65be11b
Intial setup for testing
Browse files- app.py +35 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
from deepface import DeepFace
|
3 |
+
|
4 |
+
|
5 |
+
def save_identity(image , name):
|
6 |
+
try:
|
7 |
+
embeddings = DeepFace.represent(image , model_name="Facenet")
|
8 |
+
return str(embeddings)
|
9 |
+
except Exception as error:
|
10 |
+
return str(error)
|
11 |
+
|
12 |
+
|
13 |
+
# image_input = gr.inputs.Image(shape=(160,160))
|
14 |
+
label_output = gr.outputs.Textbox()
|
15 |
+
|
16 |
+
# Create the Gradio interface
|
17 |
+
# gr.Interface(fn=predict_image, inputs=image_input, outputs=label_output).launch()
|
18 |
+
|
19 |
+
|
20 |
+
# Create Gradio interfaces for input and output
|
21 |
+
image_input = gr.inputs.Image(shape=(160, 160))
|
22 |
+
label_input = gr.inputs.Textbox(label="Enter Label")
|
23 |
+
output_image = gr.outputs.Image()
|
24 |
+
|
25 |
+
# Create the Gradio interface
|
26 |
+
interface = gr.Interface(
|
27 |
+
fn=predict_image,
|
28 |
+
inputs=[image_input, label_input],
|
29 |
+
outputs=label_output,
|
30 |
+
title="Face Identification",
|
31 |
+
description="Upload an image, enter a label, and get the output image.",
|
32 |
+
)
|
33 |
+
|
34 |
+
# Launch the Gradio interface
|
35 |
+
interface.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
numpy
|
2 |
+
deepface
|