Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,27 +1,32 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
# μ¬μ©μμ μλ΅μ λΆμνμ¬ MBTI μ νμ κ³μ°νλ ν¨μ
|
4 |
def mbti_diagnosis(*answers):
|
5 |
dimension_scores = {'E': 0, 'I': 0, 'N': 0, 'S': 0, 'T': 0, 'F': 0, 'J': 0, 'P': 0}
|
6 |
-
dimensions = ['E', 'I', 'N', 'S', 'T', 'F', 'J', 'P']
|
7 |
|
8 |
-
# κ° λ¬Ένμ λ°λΌ μ°¨μ μ μλ₯Ό μ
λ°μ΄νΈ
|
9 |
for i, answer in enumerate(answers):
|
10 |
-
# 'μ' μλ΅μ 1λ‘, 'μλμ€' μλ΅μ 0μΌλ‘ κ³μ°
|
11 |
score = 1 if answer == "μ" else 0
|
12 |
-
if i
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
# MBTI μ ν κ²°μ
|
18 |
mbti_type = ''
|
19 |
-
mbti_type += 'E' if dimension_scores['E']
|
20 |
-
mbti_type += 'N' if dimension_scores['N']
|
21 |
-
mbti_type += 'T' if dimension_scores['T']
|
22 |
-
mbti_type += 'J' if dimension_scores['J']
|
23 |
|
24 |
return mbti_type
|
|
|
|
|
25 |
questions = [
|
26 |
"μ¬λλ€κ³Ό μ΄μΈλ¦¬λ κ²μ μ’μνλμ?",
|
27 |
"ꡬ체μ μΈ μ¬μ€λ³΄λ€λ μμ΄λμ΄μ λ κ΄μ¬μ΄ λ§λμ?",
|
|
|
1 |
import gradio as gr
|
2 |
|
|
|
3 |
def mbti_diagnosis(*answers):
|
4 |
dimension_scores = {'E': 0, 'I': 0, 'N': 0, 'S': 0, 'T': 0, 'F': 0, 'J': 0, 'P': 0}
|
|
|
5 |
|
6 |
+
# κ° λ¬Ένμ λ°λΌ μ°¨μ μ μλ₯Ό μ
λ°μ΄νΈ (보μ λ λ‘μ§)
|
7 |
for i, answer in enumerate(answers):
|
|
|
8 |
score = 1 if answer == "μ" else 0
|
9 |
+
if i in [0, 1, 4, 5, 8, 9, 12, 13, 16, 17]: # E, N, T, J μ°¨μμ ν΄λΉνλ λ¬Έν μΈλ±μ€
|
10 |
+
if i % 2 == 0: # E, N
|
11 |
+
dimension_scores['E' if i < 8 else 'N'] += score
|
12 |
+
else: # I, S
|
13 |
+
dimension_scores['I' if i < 8 else 'S'] += score
|
14 |
+
else: # T, F, J, P μ°¨μμ ν΄λΉνλ λ¬Έν μΈλ±μ€
|
15 |
+
if i % 2 == 0: # T, J
|
16 |
+
dimension_scores['T' if i < 16 else 'J'] += score
|
17 |
+
else: # F, P
|
18 |
+
dimension_scores['F' if i < 16 else 'P'] += score
|
19 |
+
|
20 |
# MBTI μ ν κ²°μ
|
21 |
mbti_type = ''
|
22 |
+
mbti_type += 'E' if dimension_scores['E'] > dimension_scores['I'] else 'I'
|
23 |
+
mbti_type += 'N' if dimension_scores['N'] > dimension_scores['S'] else 'S'
|
24 |
+
mbti_type += 'T' if dimension_scores['T'] > dimension_scores['F'] else 'F'
|
25 |
+
mbti_type += 'J' if dimension_scores['J'] > dimension_scores['P'] else 'P'
|
26 |
|
27 |
return mbti_type
|
28 |
+
|
29 |
+
|
30 |
questions = [
|
31 |
"μ¬λλ€κ³Ό μ΄μΈλ¦¬λ κ²μ μ’μνλμ?",
|
32 |
"ꡬ체μ μΈ μ¬μ€λ³΄λ€λ μμ΄λμ΄μ λ κ΄μ¬μ΄ λ§λμ?",
|