suinY00N commited on
Commit
23df74f
โ€ข
1 Parent(s): a94d095

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -1
app.py CHANGED
@@ -6,7 +6,15 @@ def face_similarity(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))],
@@ -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