suinY00N commited on
Commit
9ece8fe
โ€ข
1 Parent(s): e795df5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -5,12 +5,11 @@ from deepface import DeepFace
5
  def face_similarity(img1, img2):
6
  result = DeepFace.verify(img1, img2)
7
  # distance๋ฅผ ์ด์šฉํ•ด ์œ ์‚ฌ๋„๋ฅผ 1์—์„œ ๋นผ์„œ ๋†’์„์ˆ˜๋ก ์œ ์‚ฌํ•˜๊ฒŒ ๋ณ€ํ™˜
8
- similarity = (1 - result["distance"]) * 100
9
-
10
  # ์œ ์‚ฌ๋„์— ๋”ฐ๋ฅธ ๋ฉ”์‹œ์ง€ ์กฐ๊ฑด ๋ถ„๊ธฐ
11
- if similarity > 0.7:
12
  message = "๋‘ ๋ถ„์€ ์ฒœ์ƒ์—ฐ๋ถ„!"
13
- elif 0.4 < similarity <= 0.7:
14
  message = "๋‘ ๋ถ„์€ ๋‚ด๊บผ์ธ๋“ฏ ๋‚ด๊บผ์•„๋‹Œ ๋‚ด๊บผ๊ฐ™์€...?"
15
  else:
16
  message = "์˜คํžˆ๋ ค ์ข‹์•„! ์ •๋ฐ˜๋Œ€์˜ ์‚ฌ๋žŒ์ด ๋Œ๋ฆด์ง€๋„ ๋ชฐ๋ผ์š”"
 
5
  def face_similarity(img1, img2):
6
  result = DeepFace.verify(img1, img2)
7
  # distance๋ฅผ ์ด์šฉํ•ด ์œ ์‚ฌ๋„๋ฅผ 1์—์„œ ๋นผ์„œ ๋†’์„์ˆ˜๋ก ์œ ์‚ฌํ•˜๊ฒŒ ๋ณ€ํ™˜
8
+ similarity = 1 - result["distance"]
 
9
  # ์œ ์‚ฌ๋„์— ๋”ฐ๋ฅธ ๋ฉ”์‹œ์ง€ ์กฐ๊ฑด ๋ถ„๊ธฐ
10
+ if similarity > 0.5:
11
  message = "๋‘ ๋ถ„์€ ์ฒœ์ƒ์—ฐ๋ถ„!"
12
+ elif 0.4 < similarity <= 0.5:
13
  message = "๋‘ ๋ถ„์€ ๋‚ด๊บผ์ธ๋“ฏ ๋‚ด๊บผ์•„๋‹Œ ๋‚ด๊บผ๊ฐ™์€...?"
14
  else:
15
  message = "์˜คํžˆ๋ ค ์ข‹์•„! ์ •๋ฐ˜๋Œ€์˜ ์‚ฌ๋žŒ์ด ๋Œ๋ฆด์ง€๋„ ๋ชฐ๋ผ์š”"