Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -28,12 +28,34 @@ options = [
|
|
28 |
["리λμμ λ°ννλ€", "νμμΌλ‘μ μ§μνλ€"]
|
29 |
]
|
30 |
|
31 |
-
# MBTI μ ν κ³μ° ν¨μ
|
32 |
def calculate_mbti(*answers):
|
33 |
-
#
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
# Gradio μΈν°νμ΄μ€ ꡬμ±
|
39 |
iface = gr.Interface(
|
@@ -41,10 +63,11 @@ iface = gr.Interface(
|
|
41 |
inputs=[gr.Radio(options[i], label=questions[i]) for i in range(10)],
|
42 |
outputs=[
|
43 |
gr.Textbox(label="λΉμ μ MBTI μ ν"),
|
44 |
-
gr.Textbox(label="
|
|
|
45 |
],
|
46 |
title="MBTI μ§λ¨ ν
μ€νΈ",
|
47 |
-
description="10κ°μ μ§λ¬Έμ λ΅νμ¬ λΉμ μ MBTI
|
48 |
)
|
49 |
|
50 |
# μΈν°νμ΄μ€ μ€ν
|
|
|
28 |
["리λμμ λ°ννλ€", "νμμΌλ‘μ μ§μνλ€"]
|
29 |
]
|
30 |
|
31 |
+
# MBTI μ ν κ³μ° λ° μ 보 λ°ν ν¨μ
|
32 |
def calculate_mbti(*answers):
|
33 |
+
# MBTI μ°¨μ μ μ μ΄κΈ°ν
|
34 |
+
dimensions = {"E": 0, "I": 0, "S": 0, "N": 0, "T": 0, "F": 0, "J": 0, "P": 0}
|
35 |
+
|
36 |
+
# μ¬μ©μμ μ νμ λ°λΌ μ°¨μ μ μ μ
λ°μ΄νΈ
|
37 |
+
for answer, (introvert, extrovert) in zip(answers, [(1, 0), (0, 1), (1, 0), (0, 1), (1, 0), (0, 1), (0, 1), (0, 1), (1, 0), (1, 0)]):
|
38 |
+
if answer == 0: # 첫 λ²μ§Έ μ΅μ
μ ν
|
39 |
+
dimensions["E"] += extrovert
|
40 |
+
dimensions["I"] += introvert
|
41 |
+
else: # λ λ²μ§Έ μ΅μ
μ ν
|
42 |
+
dimensions["S"] += extrovert
|
43 |
+
dimensions["N"] += introvert
|
44 |
+
dimensions["T"] += extrovert
|
45 |
+
dimensions["F"] += introvert
|
46 |
+
dimensions["J"] += extrovert
|
47 |
+
dimensions["P"] += introvert
|
48 |
+
|
49 |
+
# MBTI μ ν κ²°μ
|
50 |
+
mbti_type = ""
|
51 |
+
mbti_type += "E" if dimensions["E"] >= dimensions["I"] else "I"
|
52 |
+
mbti_type += "S" if dimensions["S"] >= dimensions["N"] else "N"
|
53 |
+
mbti_type += "T" if dimensions["T"] >= dimensions["F"] else "F"
|
54 |
+
mbti_type += "J" if dimensions["J"] >= dimensions["P"] else "P"
|
55 |
+
|
56 |
+
# MBTI μ νμ λ°λ₯Έ μ±κ²©μ μ₯λ¨μ κ³Ό μ λͺ
μΈ λ°ν
|
57 |
+
mbti_details = mbti_info.get(mbti_type, {"μ₯λ¨μ ": "μ 보 μμ", "μ λͺ
μΈ": "μ 보 μμ"})
|
58 |
+
return mbti_type, mbti_details["μ₯λ¨μ "], mbti_details["μ λͺ
μΈ"]
|
59 |
|
60 |
# Gradio μΈν°νμ΄μ€ ꡬμ±
|
61 |
iface = gr.Interface(
|
|
|
63 |
inputs=[gr.Radio(options[i], label=questions[i]) for i in range(10)],
|
64 |
outputs=[
|
65 |
gr.Textbox(label="λΉμ μ MBTI μ ν"),
|
66 |
+
gr.Textbox(label="μ νμ μ₯λ¨μ "),
|
67 |
+
gr.Textbox(label="λνμ μΈ μ λͺ
μΈ")
|
68 |
],
|
69 |
title="MBTI μ§λ¨ ν
μ€νΈ",
|
70 |
+
description="10κ°μ μ§λ¬Έμ λ΅νμ¬ λΉμ μ MBTI μ νκ³Ό κ·Έ μ νμ μ₯λ¨μ , λνμ μΈ μ λͺ
μΈμ μμ보μΈμ."
|
71 |
)
|
72 |
|
73 |
# μΈν°νμ΄μ€ μ€ν
|