Update app.py
Browse files
app.py
CHANGED
@@ -1,26 +1,17 @@
|
|
1 |
import gradio as gr
|
2 |
-
import face_recognition
|
3 |
-
import numpy as np
|
4 |
-
from PIL import Image
|
5 |
-
|
6 |
from deepface import DeepFace
|
7 |
-
import pandas as pd
|
8 |
-
|
9 |
-
# 이미지 경로
|
10 |
-
img1_path = 'path/to/image1.jpg'
|
11 |
-
img2_path = 'path/to/image2.jpg'
|
12 |
-
|
13 |
-
# 얼굴 유사도 측정
|
14 |
-
result = DeepFace.verify(img1_path, img2_path)
|
15 |
|
16 |
-
|
17 |
-
|
|
|
|
|
|
|
|
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
|
25 |
iface.launch()
|
26 |
-
|
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
2 |
from deepface import DeepFace
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
+
def face_similarity(img1, img2):
|
5 |
+
result = DeepFace.verify(img1, img2)
|
6 |
+
similarity = result["distance"] # 낮을수록 더 유사
|
7 |
+
verified = result["verified"]
|
8 |
+
|
9 |
+
return f"유사도: {similarity}, 인증 결과: {verified}"
|
10 |
|
11 |
+
iface = gr.Interface(fn=face_similarity,
|
12 |
+
inputs=[gr.inputs.Image(shape=(224, 224)), gr.inputs.Image(shape=(224, 224))],
|
13 |
+
outputs="text",
|
14 |
+
title="얼굴 유사도 측정",
|
15 |
+
description="두 얼굴 이미지를 업로드해서 유사도를 측정합니다.")
|
16 |
|
17 |
iface.launch()
|
|