|
import gradio as gr |
|
|
|
|
|
questions = [ |
|
"์๋ก์ด ์ฌ๋๋ค๊ณผ ๋ง๋ ๋ ์ฃผ๋ก ์ด๋ป๊ฒ ํ๋ํ๋์?", |
|
"๊ณํ์ ์ธ์ฐ๋ ๊ฒ๋ณด๋ค spontaneity๋ฅผ ์ ํธํ๋์?", |
|
"์ธ๋ถ์ ์ธ ์ฌ์ค๋ณด๋ค๋ ํฐ ๊ทธ๋ฆผ์ ๋ณด๋ ๊ฒ์ ์ ํธํ๋์?", |
|
"๊ฒฐ์ ์ ๋ด๋ฆด ๋ ๋
ผ๋ฆฌ์ ์ด์ฑ์ ๋ ์ค์ํ๋์, ์๋๋ฉด ์ฌ๋๋ค์ ๊ฐ์ ๊ณผ ์๊ฒฌ์ ๋ ์ค์ํ๋์?", |
|
"ํ๋ก์ ํธ๋ฅผ ์์ํ ๋ ๋ฐ๋ก ์คํ์ ์ฎ๊ธฐ๊ธฐ๋ณด๋ค๋ ๊ณํ์ ์ธ์ฐ๋ ๊ฒ์ ์ ํธํ๋์?", |
|
"์๋ก์ด ์์ด๋์ด๋ณด๋ค๋ ๊ฒ์ฆ๋ ์์ด๋์ด์ ๋ ์์กดํ๋ ํธ์ธ๊ฐ์?", |
|
"์ฌ๋๋ค๊ณผ ์ด์ธ๋ฆด ๋ ์๋์ง๋ฅผ ์ป๋์, ์๋๋ฉด ํผ์ ์์ ๋ ์๋์ง๋ฅผ ์ป๋์?", |
|
"์ค์ฉ์ ์ธ ํด๊ฒฐ์ฑ
์ ์ ํธํ๋์, ์๋๋ฉด ์ฐฝ์์ ์ธ ํด๊ฒฐ์ฑ
์ ์ ํธํ๋์?", |
|
"๊ฐ์ ์ ํํํ๋ ๊ฒ์ ์์ด์ ์์งํ ํธ์ธ๊ฐ์, ์๋๋ฉด ์กฐ์ฌ์ค๋ฌ์ด ํธ์ธ๊ฐ์?", |
|
"๊ณํ์ ๋ฐ๋ผ ์ผํ๋ ๊ฒ์ ์ ํธํ๋์, ์๋๋ฉด ์ ์ฐํ๊ฒ ์ผํ๋ ๊ฒ์ ์ ํธํ๋์?" |
|
] |
|
|
|
|
|
choices = ["๋งค์ฐ ๊ทธ๋ ๋ค", "๊ทธ๋ ๋ค", "์๋๋ค", "์ ํ ์๋๋ค"] |
|
|
|
|
|
def calculate_mbti(*answers): |
|
|
|
scores = {"E": 0, "I": 0, "S": 0, "N": 0, "T": 0, "F": 0, "J": 0, "P": 0} |
|
|
|
for answer in answers: |
|
if answer == "๋งค์ฐ ๊ทธ๋ ๋ค": |
|
scores["E"] += 2 |
|
elif answer == "๊ทธ๋ ๋ค": |
|
scores["I"] += 1 |
|
elif answer == "์๋๋ค": |
|
scores["N"] += 1 |
|
elif answer == "์ ํ ์๋๋ค": |
|
scores["S"] += 2 |
|
|
|
mbti_type = "" |
|
mbti_type += "E" if scores["E"] >= scores["I"] else "I" |
|
mbti_type += "S" if scores["S"] >= scores["N"] else "N" |
|
mbti_type += "T" if scores["T"] >= scores["F"] else "F" |
|
mbti_type += "J" if scores["J"] >= scores["P"] else "P" |
|
|
|
|
|
interpretations = { |
|
"INTJ": "์ ๋ต๊ฐ, ๋
์ฐฝ์ ์ด๊ณ ๋
๋ฆฝ์ ์ธ ์ฌ๊ณ ๋ฅผ ๊ฐ์ง ์ฌ๋์
๋๋ค.", |
|
|
|
} |
|
return f"๋น์ ์ MBTI ์ ํ์ {mbti_type}์
๋๋ค. {interpretations.get(mbti_type, 'ํด์ ์ค๋น ์ค์
๋๋ค.')}" |
|
|
|
|
|
iface = gr.Interface( |
|
fn=calculate_mbti, |
|
inputs=[gr.Radio(choices, label=question) for question in questions], |
|
outputs="text", |
|
title="MBTI ์ง๋จ ํ
์คํธ", |
|
description="๋ค์ ์ง๋ฌธ์ ๋ตํ์ฌ ๋น์ ์ MBTI ์ ํ์ ์์๋ณด์ธ์." |
|
) |
|
|
|
iface.launch() |