Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,15 @@ def face_similarity(img1, img2):
|
|
6 |
similarity = result["distance"] # ๋ฎ์์๋ก ๋ ์ ์ฌ
|
7 |
verified = result["verified"]
|
8 |
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
iface = gr.Interface(fn=face_similarity,
|
12 |
inputs=[gr.inputs.Image(shape=(224, 224)), gr.inputs.Image(shape=(224, 224))],
|
@@ -16,6 +24,26 @@ iface = gr.Interface(fn=face_similarity,
|
|
16 |
|
17 |
iface.launch()
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
# import gradio as gr
|
20 |
# from deepface import DeepFace
|
21 |
# import pandas as pd
|
|
|
6 |
similarity = result["distance"] # ๋ฎ์์๋ก ๋ ์ ์ฌ
|
7 |
verified = result["verified"]
|
8 |
|
9 |
+
# ์ ์ฌ๋์ ๋ฐ๋ฅธ ๋ฉ์์ง ์กฐ๊ฑด ๋ถ๊ธฐ
|
10 |
+
if similarity >= 0.5:
|
11 |
+
message = "๋ ๋ถ์ ์ฒ์์ฐ๋ถ!"
|
12 |
+
elif 0.3 <= similarity < 0.5:
|
13 |
+
message = "๋ ๋ถ์ ๋ด๊บผ์ธ๋ฏ ๋ด๊บผ์๋ ๋ด๊บผ๊ฐ์...?"
|
14 |
+
else:
|
15 |
+
message = "์คํ๋ ค ์ข์! ์ ๋ฐ๋์ ์ฌ๋์ด ๋๋ฆด์ง๋ ๋ชฐ๋ผ์"
|
16 |
+
|
17 |
+
return f"์ ์ฌ๋: {similarity}, ๋งค์นญ ๊ฒฐ๊ณผ: {verified}\n{message}"
|
18 |
|
19 |
iface = gr.Interface(fn=face_similarity,
|
20 |
inputs=[gr.inputs.Image(shape=(224, 224)), gr.inputs.Image(shape=(224, 224))],
|
|
|
24 |
|
25 |
iface.launch()
|
26 |
|
27 |
+
|
28 |
+
|
29 |
+
# import gradio as gr
|
30 |
+
# from deepface import DeepFace
|
31 |
+
|
32 |
+
# def face_similarity(img1, img2):
|
33 |
+
# result = DeepFace.verify(img1, img2)
|
34 |
+
# similarity = result["distance"] # ๋ฎ์์๋ก ๋ ์ ์ฌ
|
35 |
+
# verified = result["verified"]
|
36 |
+
|
37 |
+
# return f"์ ์ฌ๋: {similarity}, ๋งค์นญ ๊ฒฐ๊ณผ: {verified}"
|
38 |
+
|
39 |
+
# iface = gr.Interface(fn=face_similarity,
|
40 |
+
# inputs=[gr.inputs.Image(shape=(224, 224)), gr.inputs.Image(shape=(224, 224))],
|
41 |
+
# outputs="text",
|
42 |
+
# title="์ผ๊ตด ์ ์ฌ๋ ์ธก์ ",
|
43 |
+
# description="๋ ์ผ๊ตด ์ด๋ฏธ์ง๋ฅผ ์
๋ก๋ํด์ ์ ์ฌ๋๋ฅผ ์ธก์ ํฉ๋๋ค.")
|
44 |
+
|
45 |
+
# iface.launch()
|
46 |
+
|
47 |
# import gradio as gr
|
48 |
# from deepface import DeepFace
|
49 |
# import pandas as pd
|