Download app.py from honey90/mbtitest: direct link, hf CLI and curl.
- Browser
- Download file 26.2 kB
-
https://huggingface.co/spaces/honey90/mbtitest/resolve/main/app.py
- Command line
-
hf download hf://spaces/honey90/mbtitest/app.py
-
curl -L -o app.py https://huggingface.co/spaces/honey90/mbtitest/resolve/main/app.py
26.2 kB
| import gradio as gr | |
| # MBTI ๊ด๋ จ ๋ฐ์ดํฐ | |
| questions = [ | |
| { | |
| "question": "1. ์๋ก์ด ์ฌ๋๋ค์ ๋ง๋ ๋, ๋น์ ์:", | |
| "options": ["A. ๋จผ์ ๋ค๊ฐ๊ฐ ๋ํ๋ฅผ ์์ํ๋ ํธ์ด๋ค.", "B. ๋ค๋ฅธ ์ฌ๋์ด ๋จผ์ ๋ค๊ฐ์ ์ฃผ๊ธธ ๊ธฐ๋ค๋ฆฌ๋ ํธ์ด๋ค."], | |
| "scale": "EI", # E=A, I=B | |
| }, | |
| { | |
| "question": "2. ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ๋, ๋น์ ์:", | |
| "options": ["A. ๊ฒฝํ๊ณผ ์ฌ์ค์ ์์กดํ๋ ํธ์ด๋ค.", "B. ์ง๊ด๊ณผ ๊ฐ๋ฅ์ฑ์ ๊ณ ๋ คํ๋ ํธ์ด๋ค."], | |
| "scale": "SN", # S=A, N=B | |
| }, | |
| { | |
| "question": "3. ๊ฒฐ์ ์ ๋ด๋ฆด ๋, ๋น์ ์:", | |
| "options": ["A. ๋ ผ๋ฆฌ์ ๊ฐ๊ด์ ์ฌ์ค์ ์ค์ํ๋ค.", "B. ๊ฐ์ ๊ณผ ๊ด๊ณ๋ฅผ ๊ณ ๋ คํ๋ค."], | |
| "scale": "TF", # T=A, F=B | |
| }, | |
| { | |
| "question": "4. ์ผ์ ์ํ์์, ๋น์ ์:", | |
| "options": ["A. ๊ณํ์ ์ธ์ฐ๊ณ ์ฒด๊ณ์ ์ผ๋ก ํ๋ํ๋ค.", "B. ์ ์ฐํ๊ฒ ์ํฉ์ ๋ฐ๋ผ ๋์ฒํ๋ค."], | |
| "scale": "JP", # J=A, P=B | |
| }, | |
| { | |
| "question": "5. ์ฃผ๋ง ๊ณํ์:", | |
| "options": ["A. ์น๊ตฌ๋ค๊ณผ ๋ง๋๊ฑฐ๋ ์ธ๋ถ ํ๋์ ์ ํธํ๋ค.", "B. ํผ์ ์๊ฑฐ๋ ์์์ ์นํ ์ฌ๋๊ณผ ๋ณด๋ด๋ ๊ฒ์ ์ ํธํ๋ค."], | |
| "scale": "EI", # E=A, I=B | |
| }, | |
| { | |
| "question": "6. ๊ด์ฌ์ ๊ฐ๋ ์ฃผ์ ๋:", | |
| "options": ["A. ๊ตฌ์ฒด์ ์ด๊ณ ์ค์ง์ ์ธ ๊ฒ๋ค์ด๋ค.", "B. ์ถ์์ ์ด๊ณ ๊ฐ๋ ์ ์ธ ๊ฒ๋ค์ด๋ค."], | |
| "scale": "SN", # S=A, N=B | |
| }, | |
| { | |
| "question": "7. ๊ฐ๋ฑ ์ํฉ์์, ๋น์ ์:", | |
| "options": ["A. ๊ฐ๊ด์ ์ฌ์ค์ ๋ฐํ์ผ๋ก ๋ ผ๋ฆฌ์ ์ผ๋ก ์ ๊ทผํ๋ค.", "B. ๊ฐ์ ๊ณผ ์กฐํ๋ฅผ ๊ณ ๋ คํ์ฌ ์ ๊ทผํ๋ค."], | |
| "scale": "TF", # T=A, F=B | |
| }, | |
| { | |
| "question": "8. ์ฌํ์ ๊ฐ ๋, ๋น์ ์:", | |
| "options": ["A. ์ธ๋ถ ์ผ์ ์ ๋ฏธ๋ฆฌ ๊ณํํ๋ค.", "B. ๋๋ต์ ์ธ ๋ฐฉํฅ๋ง ์ ํ๊ณ ์ฆํฅ์ ์ผ๋ก ๊ฒฐ์ ํ๋ค."], | |
| "scale": "JP", # J=A, P=B | |
| }, | |
| { | |
| "question": "9. ๋ํ์์, ๋น์ ์:", | |
| "options": ["A. ๋ค์ํ ์ฃผ์ ๋ก ํญ๋๊ฒ ์ด์ผ๊ธฐํ๋ ๊ฒ์ ์ฆ๊ธด๋ค.", "B. ํน์ ์ฃผ์ ์ ๋ํด ๊น์ด ์๊ฒ ์ด์ผ๊ธฐํ๋ ๊ฒ์ ์ฆ๊ธด๋ค."], | |
| "scale": "EI", # E=A, I=B | |
| }, | |
| { | |
| "question": "10. ์๋ก์ด ์ ๋ณด๋ฅผ ๋ฐ์๋ค์ผ ๋, ๋น์ ์:", | |
| "options": ["A. ์ค์ฉ์ ์ธ ์ฉ๋์ ํ์ค์ ์ ์ฉ์ ์ด์ ์ ๋ง์ถ๋ค.", "B. ํจํด์ ์ฐพ๊ณ ์ ์ฒด์ ์ธ ์๋ฏธ๋ฅผ ํ์ ํ๋ ค ํ๋ค."], | |
| "scale": "SN", # S=A, N=B | |
| }, | |
| ] | |
| mbti_descriptions = { | |
| "ISTJ": { | |
| "title": "์ฒญ๋ ด๊ฒฐ๋ฐฑํ ๋ ผ๋ฆฌ์ฃผ์์ (ISTJ)", | |
| "description": "์ฌ์ค์ ์ค์ํ๋ ๋ฏฟ์์งํ ํ์ค์ฃผ์์์ ๋๋ค. ์ฑ ์๊ฐ์ด ๊ฐํ๊ณ ์ฒด๊ณ์ ์ด๋ฉฐ ๋ ผ๋ฆฌ์ ์ธ ์ฌ๊ณ ๋ฅผ ๋ฐํ์ผ๋ก ์ ๋ฌด๋ฅผ ์ฒ๋ฆฌํฉ๋๋ค.", | |
| "strengths": "์ฒด๊ณ์ , ์ ๋ขฐ์ฑ, ํ์ค์ , ์ฑ ์๊ฐ", | |
| "weaknesses": "์ตํต์ฑ ๋ถ์กฑ, ์ง๋์น ์๋ฒฝ์ฃผ์, ๊ฐ์ ํํ์ ์ด๋ ค์", | |
| "relationships": "์ ๋ขฐ์ ์ฑ ์๊ฐ์ ๋ฐํ์ผ๋ก ์์ ์ ์ธ ๊ด๊ณ๋ฅผ ์ ์งํฉ๋๋ค. ์์งํ๊ณ ์ง์ ์ ์ธ ์์ฌ์ํต์ ์ ํธํฉ๋๋ค.", | |
| "famous": "ํธ ์๋ฆฌ์๋ฒ ์ค 2์ธ, ์๋ ๋ฒํ, ๋ง์ดํด ์กฐ๋", | |
| "careers": "ํ๊ณ์ฌ, ์์ง๋์ด, ํ๋ก์ ํธ ๋งค๋์ , ๊ตฐ์ธ, ๋ฒ๋ฅ ๊ฐ" | |
| }, | |
| "ISFJ": { | |
| "title": "์ฉ๊ฐํ ์ํธ์ (ISFJ)", | |
| "description": "ํ์ ์ ์ด๊ณ ๋ฐ๋ปํ ์ํธ์์ ๋๋ค. ์ฑ ์๊ฐ์ด ๊ฐํ๋ฉฐ ๋ค๋ฅธ ์ฌ๋์ ํ์์ ๋ฏผ๊ฐํ๊ฒ ๋ฐ์ํฉ๋๋ค.", | |
| "strengths": "์ ๋ขฐ์ฑ, ์ค์ฉ์ฑ, ํ์ ์ , ์ธ์ฌํจ", | |
| "weaknesses": "๋ณํ์ ๋ํ ์ ํญ, ์๊ธฐ ์ฃผ์ฅ ๋ถ์กฑ, ๊ณผ๋ํ ์๊ธฐ ํฌ์", | |
| "relationships": "๊น๊ณ ์๋ฏธ ์๋ ๊ด๊ณ๋ฅผ ์ถ๊ตฌํ๋ฉฐ, ๊ฐ์กฑ๊ณผ ์น๊ตฌ๋ค์๊ฒ ํ์ ์ ์ ๋๋ค.", | |
| "famous": "์ผ์ดํธ ๋ฏธ๋คํด, ๋ง๋ ํ ๋ ์ฌ, ๋ก์ฌ ํํฌ์ค", | |
| "careers": "๊ฐํธ์ฌ, ๊ต์ฌ, ์ฌํ๋ณต์ง์ฌ, ํ์ ์ง์, ์ธ์ฌ ๋ด๋น์" | |
| }, | |
| "INFJ": { | |
| "title": "์ ์์ ์นํธ์ (INFJ)", | |
| "description": "์ด์์ฃผ์์ ์ด๊ณ ์์น์ ์ธ ์ฌ๋์ผ๋ก, ์ธ๋ฅ๋ฅผ ์ํ ๋ ๋์ ๋ฏธ๋๋ฅผ ๊ฟ๊ฟ๋๋ค. ๊น์ ํต์ฐฐ๋ ฅ๊ณผ ์ง๊ด๋ ฅ์ ๊ฐ์ง๊ณ ์์ต๋๋ค.", | |
| "strengths": "์ฐฝ์์ฑ, ํต์ฐฐ๋ ฅ, ํ๊ณ ํ ์์น, ์ด์ ์ ", | |
| "weaknesses": "์๋ฒฝ์ฃผ์, ๋ฒ์์ ๊ฒฝํฅ, ์ง๋์น ์ด์์ฃผ์", | |
| "relationships": "๊น๊ณ ์๋ฏธ ์๋ ๊ด๊ณ๋ฅผ ์ถ๊ตฌํ๋ฉฐ, ์ง์ ์ฑ ์๋ ์ํต์ ์ค์์ํฉ๋๋ค.", | |
| "famous": "๋งํด ๋ฃจํฐ ํน, ๋ฌ์จ ๋ง๋ธ๋ผ, ๋ ์ด๋ ๊ฐ๊ฐ", | |
| "careers": "์๋ด์ฌ, ์๊ฐ, ์ฌ๋ฆฌํ์, ๊ต์, ๋น์๋ฆฌ ๋จ์ฒด ํ๋๊ฐ" | |
| }, | |
| "INTJ": { | |
| "title": "์ฉ์์ฃผ๋ํ ์ ๋ต๊ฐ (INTJ)", | |
| "description": "๋ ์ฐฝ์ ์ธ ์ ๋ต๊ฐ๋ก, ๋ถ์์ ์ด๊ณ ๋ ๋ฆฝ์ ์ ๋๋ค. ๋น์ ์ ๊ฐ์ง๊ณ ์ธ์์ ๋ฐ๋ผ๋ณด๋ฉฐ ์ง์ ์ถ๊ตฌ์ ์ด์ ์ ์ ๋๋ค.", | |
| "strengths": "๋ถ์๋ ฅ, ๋ ์ฐฝ์ฑ, ์์ ๊ฐ, ๋ ๋ฆฝ์ฑ", | |
| "weaknesses": "์ง๋์น ์๋ฒฝ์ฃผ์, ๋นํ์ ์ฑํฅ, ๊ณ ์ง", | |
| "relationships": "์ง์ ๊ต๋ฅ๊ฐ ์๋ ๊ด๊ณ๋ฅผ ์ ํธํ๋ฉฐ, ๊ฐ์ ํํ์ด ์ง์ ์ ์ด์ง ์์ ์ ์์ต๋๋ค.", | |
| "famous": "์ผ๋ก ๋จธ์คํฌ, ๋งํฌ ์ ์ปค๋ฒ๊ทธ, ํฌ๋ฆฌ์คํ ํผ ๋๋", | |
| "careers": "๊ณผํ์, ์์ง๋์ด, ํ๋ก๊ทธ๋๋จธ, ์ ๋ต ์ปจ์คํดํธ, ๊ฑด์ถ๊ฐ" | |
| }, | |
| "ISTP": { | |
| "title": "๋ง๋ฅ ์ฌ์ฃผ๊พผ (ISTP)", | |
| "description": "๋๋ดํ ์ค์ฉ์ฃผ์์๋ก, ๋ค์ํ ๋๊ตฌ๋ฅผ ๋ฅ์ํ๊ฒ ๋ค๋ฃน๋๋ค. ๋ฌธ์ ํด๊ฒฐ์ ๋ฐ์ด๋๋ฉฐ ์๊ธฐ ์ํฉ์์ ์นจ์ฐฉํฉ๋๋ค.", | |
| "strengths": "์ค์ฉ์ฑ, ์ ์๋ ฅ, ๋ฌธ์ ํด๊ฒฐ ๋ฅ๋ ฅ, ํธ๊ธฐ์ฌ", | |
| "weaknesses": "์ถฉ๋์ ๊ฒฝํฅ, ํ์ ์ ์ด๋ ค์, ๊ฐ์ ํํ ๋ถ์กฑ", | |
| "relationships": "๊ฐ์ธ ๊ณต๊ฐ์ ์ค์์ํ๋ฉฐ, ์๋ฐ ์๋ ์์ ๋ก์ด ๊ด๊ณ๋ฅผ ์ ํธํฉ๋๋ค.", | |
| "famous": "ํฐ ํฌ๋ฃจ์ฆ, ํด๋ฆฐํธ ์ด์คํธ์ฐ๋, ๋ง์ดํด ์กฐ๋", | |
| "careers": "๊ธฐ๊ณ๊ณต, ์์ง๋์ด, ํ์ผ๋ฟ, ์ด๋์ ์, ๋ฐ์ดํฐ ๋ถ์๊ฐ" | |
| }, | |
| "ISFP": { | |
| "title": "ํธ๊ธฐ์ฌ ๋ง์ ์์ ๊ฐ (ISFP)", | |
| "description": "์์ ๋ก์ด ์ํผ์ ๊ฐ์ง ์์ ๊ฐ์ ๋๋ค. ๊ฐ์ฑ์ ์ด๊ณ ์จํํ๋ฉฐ ํ์ฌ์ ์๊ฐ์ ์ฆ๊ธฐ๋ ์ฑํฅ์ ๊ฐ์ง๊ณ ์์ต๋๋ค.", | |
| "strengths": "์ฐฝ์์ฑ, ๊ฐ์์ฑ, ์ถฉ์คํจ, ์ ์๋ ฅ", | |
| "weaknesses": "์ฅ๊ธฐ ๊ณํ์ ์ด๋ ค์, ๊ฐ๋ฑ ํํผ, ์ง๋์น ๊ฒธ์", | |
| "relationships": "์กฐํ๋กญ๊ณ ๋นํ์ ์ด์ง ์์ ๊ด๊ณ๋ฅผ ์ ํธํ๋ฉฐ, ํ๋์ผ๋ก ์ ์ ์ ํํํฉ๋๋ค.", | |
| "famous": "๋ฐฅ ๋๋ฐ, ๋ฐ์ด๋น๋ ๋ณด์, ํ๋ฆฌ๋ค ์นผ๋ก", | |
| "careers": "์์ ๊ฐ, ๋์์ด๋, ์์ ๊ฐ, ์ฌ์ง์๊ฐ, ํค์ด์คํ์ผ๋ฆฌ์คํธ" | |
| }, | |
| "INFP": { | |
| "title": "์ด์ ์ ์ธ ์ค์ฌ์ (INFP)", | |
| "description": "์ด์์ฃผ์์ ์ด๊ณ ๊ณต๊ฐ ๋ฅ๋ ฅ์ด ๋ฐ์ด๋ ์ค์ฌ์์ ๋๋ค. ๊น์ ๊ฐ์ธ์ ๊ฐ์น์ ์ด์ ์ ๊ฐ์ง๊ณ ์์ต๋๋ค.", | |
| "strengths": "์ฐฝ์์ฑ, ๊ณต๊ฐ ๋ฅ๋ ฅ, ์ด์์ฃผ์, ์ ์๋ ฅ", | |
| "weaknesses": "๋นํ์ค์ ๊ธฐ๋, ๊ฐ์ ์ ๋์, ์๊ธฐ ๋นํ", | |
| "relationships": "๊น๊ณ ์๋ฏธ ์๋ ๊ด๊ณ๋ฅผ ์ถ๊ตฌํ๋ฉฐ, ์ง์ ์ฑ๊ณผ ๊ฐ์ธ์ ์ฑ์ฅ์ ์ค์์ํฉ๋๋ค.", | |
| "famous": "์๋ฆฌ์ ์ ฐ์ต์คํผ์ด, ํจํจ, ์ค๋๋ฆฌ ํต๋ฒ", | |
| "careers": "์๊ฐ, ์ฌ๋ฆฌ์๋ด์ฌ, ๊ต์ฌ, ์์ ๊ฐ, ์์ ๊ฐ" | |
| }, | |
| "INTP": { | |
| "title": "๋ ผ๋ฆฌ์ ์ธ ์ฌ์๊ฐ (INTP)", | |
| "description": "ํ์ ์ ์ธ ๋ฐ๋ช ๊ฐ๋ก, ์ง์์ ๋ชฉ๋ง๋ฅด๊ณ ๋ ผ๋ฆฌ์ ์ ๋๋ค. ๋ณต์กํ ๋ฌธ์ ์ ์ด๋ก ์ ๊ฐ๋ ์ ๋งค๋ฃ๋ฉ๋๋ค.", | |
| "strengths": "๋ถ์๋ ฅ, ์ฐฝ์์ฑ, ๋ ์ฐฝ์ฑ, ๊ฐ๋ฐฉ์ฑ", | |
| "weaknesses": "์คํ์ ์ด๋ ค์, ์ฌํ์ ์ํธ์์ฉ์ ๋ถํธํจ, ์ง์ค๋ ฅ ๋ถ์ฐ", | |
| "relationships": "์ง์ ์๊ทน์ ์ฃผ๋ ๊ด๊ณ๋ฅผ ์ ํธํ๋ฉฐ, ๊ฐ์ ํํ์ด ์ํด ์ ์์ต๋๋ค.", | |
| "famous": "์๋ฒ ๋ฅดํธ ์์ธ์ํ์ธ, ์์ด๋ธ๋ฌํ ๋ง์ปจ, ๋น ๊ฒ์ด์ธ ", | |
| "careers": "๊ณผํ์, ํ๋ก๊ทธ๋๋จธ, ์ํ์, ์ฒ ํ์, ์ฐ๊ตฌ์" | |
| }, | |
| "ESTP": { | |
| "title": "๋ชจํ์ ์ฆ๊ธฐ๋ ์ฌ์ ๊ฐ (ESTP)", | |
| "description": "๋๋ดํ ์ฌ์ ๊ฐ๋ก, ํ๋์ ์ด๊ณ ํ์ค์ ์ ๋๋ค. ์๋ฐ๋ ฅ์ด ์ข๊ณ ์ํ์ ๊ฐ์ํ๋ ๊ฒ์ ๋๋ ค์ํ์ง ์์ต๋๋ค.", | |
| "strengths": "๋๋ดํจ, ์ ์๋ ฅ, ์ค์ฉ์ฑ, ํ์ค๊ฐ๊ฐ", | |
| "weaknesses": "์ธ๋ด์ฌ ๋ถ์กฑ, ๊ณํ์ฑ ๋ถ์กฑ, ์ถฉ๋์ ๊ฒฐ์ ", | |
| "relationships": "ํ๊ธฐ์ฐจ๊ณ ํฅ๋ฏธ๋ก์ด ๊ด๊ณ๋ฅผ ์ ํธํ๋ฉฐ, ์ค์ฉ์ ์ด๊ณ ์ง์ ์ ์ธ ์์ฌ์ํต์ ํฉ๋๋ค.", | |
| "famous": "๋๋๋ ํธ๋ผํ, ๋ง๋๋, ์ญ ๋์ฝ์จ", | |
| "careers": "๊ธฐ์ ๊ฐ, ์ธ์ผ์ฆ๋งจ, ๋ง์ผํฐ, ๊ฒฝ์์, ์ด๋์ ์" | |
| }, | |
| "ESFP": { | |
| "title": "์์ ๋ก์ด ์ํผ์ ์ฐ์์ธ (ESFP)", | |
| "description": "์ฆํฅ์ ์ด๊ณ ์ด์ ์ ์ธ ์ฐ์์ธ์ ๋๋ค. ํ๊ธฐ์ฐจ๊ณ ๋งค๋ ฅ์ ์ด๋ฉฐ ์๊ฐ์ ์ฆ๊ธฐ๋ ์ฑํฅ์ด ์์ต๋๋ค.", | |
| "strengths": "์ด์ , ์ฌ๊ต์ฑ, ๋๊ด์ฑ, ์ค์ฉ์ฑ", | |
| "weaknesses": "์ฅ๊ธฐ ๊ณํ์ ์ด๋ ค์, ์ฌ๊ฐํ ์ฃผ์ ํํผ, ์ง๋์น ์ฆํฅ์ฑ", | |
| "relationships": "์ฆ๊ฒ๊ณ ํ๊ธฐ์ฐฌ ๊ด๊ณ๋ฅผ ์ถ๊ตฌํ๋ฉฐ, ๊ด๋ํ๊ณ ์์ฉ์ ์ธ ํ๋๋ฅผ ๋ณด์ ๋๋ค.", | |
| "famous": "์๋น์ค ํ๋ ์ฌ๋ฆฌ, ์๋ธ, ์ ์ด๋ฏธ ์ฌ๋ฆฌ๋ฒ", | |
| "careers": "์ฐ์์ธ, ํธํ ๋ฆฌ์ด, ์ด๋ฒคํธ ํ๋๋, ์ธ์ผ์ฆ๋งจ, ์๋ฆฌ์ฌ" | |
| }, | |
| "ENFP": { | |
| "title": "์ฌ๊ธฐ๋ฐ๋ํ ํ๋๊ฐ (ENFP)", | |
| "description": "์ด์ ์ ์ด๊ณ ์ฐฝ์์ ์ธ ์์ ์ํผ์ ๋๋ค. ๊ฐ๋ฅ์ฑ์ ๋ณด๋ ๋์ด ๋ฐ์ด๋๋ฉฐ ์๋ก์ด ์์ด๋์ด์ ์ฌ๋๋ค์๊ฒ ์ด์ ์ ์ ๋๋ค.", | |
| "strengths": "์ด์ , ์ฐฝ์์ฑ, ์ฌ๊ต์ฑ, ์ ์๋ ฅ", | |
| "weaknesses": "์ง์ค๋ ฅ ๋ถ์กฑ, ํ์ค์ ์ธ๋ถ์ฌํญ ๊ฐ๊ณผ, ๊ณผ๋ํ ๋ ๋ฆฝ์ฌ", | |
| "relationships": "๊น๊ณ ์๋ฏธ ์๋ ๊ด๊ณ๋ฅผ ์ถ๊ตฌํ๋ฉฐ, ์๋๋ฐฉ์ ์ฑ์ฅ์ ๋๋๋ฐ ์ด์ ์ ์ ๋๋ค.", | |
| "famous": "๋ก๋น ์๋ฆฌ์์ค, ์ํธ ๋์ฆ๋, ์๋ฐ ๋์ ๋๋ฌ์ค", | |
| "careers": "์ฝ์น, ๊ธฐ์ ๊ฐ, ๋ง์ผํฐ, ์ํฐ์คํธ, ์ ๋๋ฆฌ์คํธ" | |
| }, | |
| "ENTP": { | |
| "title": "๋ ผ์์ ์ฆ๊ธฐ๋ ๋ณ๋ก ๊ฐ (ENTP)", | |
| "description": "์๋ฆฌํ๊ณ ํธ๊ธฐ์ฌ ๋ง์ ์ฌ์๊ฐ์ ๋๋ค. ์ง์ ๋์ ์ ์ฆ๊ธฐ๋ฉฐ ์๋ก์ด ์์ด๋์ด์ ๊ฐ๋ฅ์ฑ์ ํ์ํฉ๋๋ค.", | |
| "strengths": "์ฐฝ์์ฑ, ์ ์๋ ฅ, ๋ ผ๋ฆฌ๋ ฅ, ์ง์ ํธ๊ธฐ์ฌ", | |
| "weaknesses": "์ผ๊ด์ฑ ๋ถ์กฑ, ๋ ผ์์ ์ฑํฅ, ์คํ๋ ฅ ๋ถ์กฑ", | |
| "relationships": "์ง์ ์ผ๋ก ์๊ทน์ ์ธ ๊ด๊ณ๋ฅผ ์ ํธํ๋ฉฐ, ๋ค์ํ ์ฃผ์ ์ ๋ํ ์ด๋ฆฐ ํ ๋ก ์ ์ฆ๊น๋๋ค.", | |
| "famous": "์คํฐ๋ธ ์ก์ค, ๋ฆฌ์ฒ๋ ํ์ธ๋ง, ๋ก๋ฒํธ ๋ค์ฐ๋ ์ฃผ๋์ด", | |
| "careers": "๊ธฐ์ ๊ฐ, ๋ณํธ์ฌ, ๋ฐ๋ช ๊ฐ, ๋ง์ผํฐ, ์์ง๋์ด" | |
| }, | |
| "ESTJ": { | |
| "title": "์๊ฒฉํ ๊ด๋ฆฌ์ (ESTJ)", | |
| "description": "์ฒด๊ณ์ ์ด๊ณ ์ค์ฉ์ ์ธ ๊ด๋ฆฌ์์ ๋๋ค. ์ ํต๊ณผ ์ง์๋ฅผ ์ค์ํ๋ฉฐ ๋ชฉํ ๋ฌ์ฑ์ ์ํด ํจ์จ์ ์ผ๋ก ํ๋ํฉ๋๋ค.", | |
| "strengths": "์กฐ์ง๋ ฅ, ์ฑ ์๊ฐ, ๊ฒฐ๋จ๋ ฅ, ์ ๋ขฐ์ฑ", | |
| "weaknesses": "์ตํต์ฑ ๋ถ์กฑ, ๊ฐ์ ์ ๋๊ฐ, ์ง๋์น ์ง๋ฐฐ๋ ฅ", | |
| "relationships": "๋ช ํํ ์ญํ ๊ณผ ์ฑ ์์ด ์๋ ๊ด๊ณ๋ฅผ ์ ํธํ๋ฉฐ, ์ง์ ์ ์ด๊ณ ์์งํ ์์ฌ์ํต์ ํฉ๋๋ค.", | |
| "famous": "๋ฏธ์ ธ ์ค๋ฐ๋ง, ์ค๋๋ฅ ์นด๋ค๊ธฐ, ๊ณ ๋ ๋จ์ง", | |
| "careers": "๋งค๋์ , ๊ฒฝ์์, ๊ตฐ์ธ, ํ์ฌ, ์ฌ์ ๋ถ์๊ฐ" | |
| }, | |
| "ESFJ": { | |
| "title": "์ฌ๊ต์ ์ธ ์ธ๊ต๊ด (ESFJ)", | |
| "description": "๋ฐฐ๋ ค์ฌ ๊น๊ณ ์ฌ๊ต์ ์ธ ๋ณด์ดํ ์ ๊ณต์์ ๋๋ค. ์กฐํ์ ํ๋ ฅ์ ์ค์ํ๋ฉฐ ํ์ธ์ ํ์์ ๋ฏผ๊ฐํฉ๋๋ค.", | |
| "strengths": "ํ๋ ฅ, ์ถฉ์คํจ, ๋ฐฐ๋ ค์ฌ, ์ค์ฉ์ฑ", | |
| "weaknesses": "๋นํ์ ๋ฏผ๊ฐ, ๊ฐ๋ฑ ํํผ, ๊ณผ๋ํ ์๊ธฐํฌ์", | |
| "relationships": "ํํฉ๊ณผ ์์ ์ ์ค์ํ๋ ๊ด๊ณ๋ฅผ ์ถ๊ตฌํ๋ฉฐ, ์ฃผ๋ณ ์ฌ๋๋ค์ ๋ณด์ดํผ๋๋ฐ ์ด์ ์ ์ ๋๋ค.", | |
| "famous": "ํ ์ผ๋ฌ ์ค์ํํธ, ๋น ํด๋ฆฐํด, ์ ๋ํผ ๋กํ์ฆ", | |
| "careers": "๊ต์ฌ, ๊ฐํธ์ฌ, ์ธ์ฌ ๊ด๋ฆฌ์, ์ฌํ๋ณต์ง์ฌ, ์ด๋ฒคํธ ํ๋๋" | |
| }, | |
| "ENFJ": { | |
| "title": "์ ์๋ก์ด ์ฌํ์ด๋๊ฐ (ENFJ)", | |
| "description": "์นด๋ฆฌ์ค๋ง ์๋ ์ง๋์๋ก, ์๊ฐ์ ์ฃผ๊ณ ๋ค๋ฅธ ์ฌ๋์ ์ฑ์ฅ์ ๋์ต๋๋ค. ์ฌ๋๋ค์ ์ ์ฌ๋ ฅ์ ๋ณด๊ณ ๊ทธ๋ค์ ๋๊ธฐ๋ถ์ฌํฉ๋๋ค.", | |
| "strengths": "๊ณต๊ฐ ๋ฅ๋ ฅ, ๋ฆฌ๋์ญ, ์ํฅ๋ ฅ, ์ ์๋ ฅ", | |
| "weaknesses": "๊ณผ๋ํ ์ด์์ฃผ์, ๋นํ์ ๋ฏผ๊ฐ, ์๊ธฐ ์ํ", | |
| "relationships": "์ง์ ์ฑ ์๊ณ ์๋ฏธ ์๋ ๊ด๊ณ๋ฅผ ์ถ๊ตฌํ๋ฉฐ, ์๋๋ฐฉ์ ์ฑ์ฅ๊ณผ ํ๋ณต์ ๋๋๋ฐ ํ์ ํฉ๋๋ค.", | |
| "famous": "์คํ๋ผ ์ํ๋ฆฌ, ๋ฒ๋ฝ ์ค๋ฐ๋ง, ์กด ๋ ๋ ผ", | |
| "careers": "๊ต์ก์, ์๋ด์ฌ, ์ธ์ฌ ๊ด๋ฆฌ์, ๋ง์ผํฐ, ์ ์น์ธ" | |
| }, | |
| "ENTJ": { | |
| "title": "๋๋ดํ ํต์์ (ENTJ)", | |
| "description": "๊ณผ๊ฐํ๊ณ ์์๋ ฅ ํ๋ถํ ์ง๋์์ ๋๋ค. ๊ฒฐ๋จ๋ ฅ ์๊ณ ์ง์ ์ ์ด๋ฉฐ ๋ชฉํ ๋ฌ์ฑ์ ์ํด ํจ์จ์ ์ผ๋ก ์ผํฉ๋๋ค.", | |
| "strengths": "๋ฆฌ๋์ญ, ๊ฒฐ๋จ๋ ฅ, ์ ๋ต์ ์ฌ๊ณ , ์์ ๊ฐ", | |
| "weaknesses": "์ฐธ์์ฑ ๋ถ์กฑ, ์ง๋์น ์ง๋ฐฐ๋ ฅ, ๊ฐ์ ์ ๋๊ฐ", | |
| "relationships": "๋ชฉํ ์งํฅ์ ์ด๊ณ ์ง์ ์ธ ๊ด๊ณ๋ฅผ ์ ํธํ๋ฉฐ, ์ง์ ์ ์ด๊ณ ์์งํ ์์ฌ์ํต์ ํฉ๋๋ค.", | |
| "famous": "์คํฐ๋ธ ์ก์ค, ๋ง๊ฐ๋ ๋์ฒ, ํ๋ญํด๋ฆฐ D. ๋ฃจ์ฆ๋ฒจํธ", | |
| "careers": "๊ฒฝ์์, ๊ธฐ์ ๊ฐ, ๋ณํธ์ฌ, ์ปจ์คํดํธ, ์ ์น์ธ" | |
| } | |
| } | |
| def calculate_mbti(scores): | |
| mbti = "" | |
| mbti += "E" if scores["EI"] > 0 else "I" | |
| mbti += "S" if scores["SN"] > 0 else "N" | |
| mbti += "T" if scores["TF"] > 0 else "F" | |
| mbti += "J" if scores["JP"] > 0 else "P" | |
| return mbti | |
| with gr.Blocks(theme=gr.themes.Soft()) as app: | |
| # ์ํ ๊ด๋ฆฌ | |
| state = gr.State({ | |
| "current_question": 0, | |
| "scores": {"EI": 0, "SN": 0, "TF": 0, "JP": 0}, | |
| "completed": False | |
| }) | |
| # ํค๋ ์น์ | |
| gr.Markdown("# MBTI ์ฑ๊ฒฉ ์ ํ ์ง๋จ") | |
| with gr.Column(): | |
| intro = gr.Markdown(""" | |
| ์ด ํ ์คํธ๋ ๋น์ ์ MBTI ์ฑ๊ฒฉ ์ ํ์ ์ง๋จํ๋ ๊ฐ๋จํ ๋๊ตฌ์ ๋๋ค. | |
| 10๊ฐ์ ์ง๋ฌธ์ ๋ตํ๋ฉด 16๊ฐ์ง MBTI ์ฑ๊ฒฉ ์ ํ ์ค ๋น์ ์๊ฒ ๊ฐ์ฅ ์ ํฉํ ์ ํ์ ์๋ ค๋๋ฆฝ๋๋ค. | |
| * ๊ฐ ์ง๋ฌธ์๋ A ๋๋ B ๋ ๊ฐ์ง ์ ํ์ง๊ฐ ์์ต๋๋ค. | |
| * ์์ ๊ณผ ๊ฐ์ฅ ๊ฐ๊น๋ค๊ณ ์๊ฐ๋๋ ๋ต๋ณ์ ์์งํ๊ฒ ์ ํํด์ฃผ์ธ์. | |
| * ๋ชจ๋ ์ง๋ฌธ์ ๋ตํ๋ฉด ์์ธํ ์ฑ๊ฒฉ ์ ํ ๋ถ์ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ์ ์ ์์ต๋๋ค. | |
| """) | |
| start_button = gr.Button("ํ ์คํธ ์์ํ๊ธฐ", variant="primary", size="lg") | |
| # ์ง๋ฌธ ์น์ | |
| with gr.Group(visible=False) as question_section: | |
| question_text = gr.Markdown("## ์ง๋ฌธ") | |
| answer_radio = gr.Radio( | |
| choices=["A", "B"], | |
| label="์ ํํด์ฃผ์ธ์", | |
| value=None | |
| ) | |
| with gr.Row(): | |
| prev_button = gr.Button("์ด์ ์ง๋ฌธ", visible=False) | |
| next_button = gr.Button("๋ค์ ์ง๋ฌธ", variant="primary") | |
| progress_bar = gr.Slider( | |
| minimum=0, | |
| maximum=len(questions), | |
| value=1, | |
| step=1, | |
| label="์งํ ์ํฉ", | |
| interactive=False | |
| ) | |
| # ๊ฒฐ๊ณผ ์น์ | |
| with gr.Group(visible=False) as result_section: | |
| result_title = gr.Markdown("## ๋น์ ์ MBTI ๊ฒฐ๊ณผ") | |
| result_content = gr.HTML() | |
| restart_button = gr.Button("๋ค์ ํ ์คํธํ๊ธฐ", variant="secondary") | |
| # ํจ์ ์ ์ | |
| def start_test(): | |
| current_q = questions[0] | |
| q_text = f"## {current_q['question']}" | |
| return { | |
| "current_question": 0, | |
| "scores": {"EI": 0, "SN": 0, "TF": 0, "JP": 0}, | |
| "completed": False | |
| }, gr.update(visible=False), gr.update(visible=True), gr.update(visible=False), q_text, gr.update(choices=current_q["options"], value=None), 1, gr.update(visible=False) | |
| def update_question(direction, state): | |
| new_index = state["current_question"] + direction | |
| if 0 <= new_index < len(questions): | |
| state["current_question"] = new_index | |
| current_q = questions[new_index] | |
| q_text = f"## {current_q['question']}" | |
| is_first = new_index == 0 | |
| is_last = new_index == len(questions) - 1 | |
| return state, q_text, gr.update(choices=current_q["options"], value=None), new_index + 1, gr.update(visible=not is_first) | |
| return state, "", gr.update(), state["current_question"] + 1, gr.update() | |
| def next_question(choice, state): | |
| if choice is None: | |
| current_q = questions[state["current_question"]] | |
| return state, f"## {current_q['question']}", gr.update(), gr.update(), gr.update() | |
| # ํ์ฌ ์ง๋ฌธ๊ณผ ๊ทธ์ ๋ํ ๋ต๋ณ ์ฒ๋ฆฌ | |
| current_q = questions[state["current_question"]] | |
| scale = current_q["scale"] | |
| # ์ ์ ์ ๋ฐ์ดํธ | |
| if choice == current_q["options"][0]: # A ์ ํ | |
| if scale == "EI": | |
| state["scores"]["EI"] += 1 | |
| elif scale == "SN": | |
| state["scores"]["SN"] += 1 | |
| elif scale == "TF": | |
| state["scores"]["TF"] += 1 | |
| elif scale == "JP": | |
| state["scores"]["JP"] += 1 | |
| else: # B ์ ํ | |
| if scale == "EI": | |
| state["scores"]["EI"] -= 1 | |
| elif scale == "SN": | |
| state["scores"]["SN"] -= 1 | |
| elif scale == "TF": | |
| state["scores"]["TF"] -= 1 | |
| elif scale == "JP": | |
| state["scores"]["JP"] -= 1 | |
| # ๋ค์ ์ง๋ฌธ ๋๋ ๊ฒฐ๊ณผ๋ก ์ด๋ | |
| next_index = state["current_question"] + 1 | |
| if next_index >= len(questions): | |
| # ๋ง์ง๋ง ์ง๋ฌธ์ด๋ฉด ๊ฒฐ๊ณผ ํ์ | |
| state["completed"] = True | |
| mbti_result = calculate_mbti(state["scores"]) | |
| description = mbti_descriptions[mbti_result] | |
| result_html = f""" | |
| <div style="text-align: center; padding: 20px; background-color: #f5f5f5; border-radius: 10px; margin-bottom: 20px;"> | |
| <h2 style="color: #333; margin-bottom: 10px;">{description["title"]}</h2> | |
| <p style="font-size: 18px; margin-bottom: 20px;">{description["description"]}</p> | |
| </div> | |
| <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 30px;"> | |
| <div style="background-color: #e6f7ff; padding: 15px; border-radius: 8px;"> | |
| <h3 style="color: #0066cc; margin-bottom: 10px;">๊ฐ์ </h3> | |
| <p>{description["strengths"]}</p> | |
| </div> | |
| <div style="background-color: #fff0f0; padding: 15px; border-radius: 8px;"> | |
| <h3 style="color: #cc0000; margin-bottom: 10px;">์ฝ์ </h3> | |
| <p>{description["weaknesses"]}</p> | |
| </div> | |
| </div> | |
| <div style="background-color: #f0f8ff; padding: 15px; border-radius: 8px; margin-bottom: 20px;"> | |
| <h3 style="color: #003366; margin-bottom: 10px;">๋์ธ๊ด๊ณ ์ฑํฅ</h3> | |
| <p>{description["relationships"]}</p> | |
| </div> | |
| <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px;"> | |
| <div style="background-color: #f5f5dc; padding: 15px; border-radius: 8px;"> | |
| <h3 style="color: #8b4513; margin-bottom: 10px;">๋ํ ์ธ๋ฌผ</h3> | |
| <p>{description["famous"]}</p> | |
| </div> | |
| <div style="background-color: #f0fff0; padding: 15px; border-radius: 8px;"> | |
| <h3 style="color: #006400; margin-bottom: 10px;">์ ํฉํ ์ง์ </h3> | |
| <p>{description["careers"]}</p> | |
| </div> | |
| </div> | |
| <div style="text-align: center; margin-top: 30px; padding: 15px; background-color: #fffaf0; border-radius: 8px;"> | |
| <p style="font-style: italic; color: #666;">โป ์ด ๊ฒฐ๊ณผ๋ ๊ฐ๋จํ ์ง๋ฌธ์ ํตํ ์ฐธ๊ณ ์ฉ์ด๋ฉฐ, ์ ๋ฌธ์ ์ธ MBTI ๊ฒ์ฌ๋ ๊ณต์ธ๋ ๊ธฐ๊ด์ ํตํด ๋ฐ์ผ์๊ธฐ ๋ฐ๋๋๋ค.</p> | |
| </div> | |
| """ | |
| return state, gr.update(visible=False), gr.update(visible=True), f"## ๋น์ ์ MBTI ์ ํ์: {mbti_result}", result_html, gr.update() | |
| # ๋ค์ ์ง๋ฌธ์ผ๋ก ์ด๋ | |
| state["current_question"] = next_index | |
| next_q = questions[next_index] | |
| return state, f"## {next_q['question']}", gr.update(choices=next_q["options"], value=None), next_index + 1, gr.update(visible=True), gr.update() | |
| def restart(): | |
| return { | |
| "current_question": 0, | |
| "scores": {"EI": 0, "SN": 0, "TF": 0, "JP": 0}, | |
| "completed": False | |
| }, gr.update(visible=True), gr.update(visible=False), gr.update(visible=True), gr.update(visible=False), "## " + questions[0]["question"], gr.update(choices=questions[0]["options"], value=None), 1, gr.update(visible=False) | |
| # ์ด๋ฒคํธ ์ฐ๊ฒฐ | |
| start_button.click( | |
| fn=start_test, | |
| outputs=[state, intro, question_section, result_section, question_text, answer_radio, progress_bar, prev_button] | |
| ) | |
| next_button.click( | |
| fn=next_question, | |
| inputs=[answer_radio, state], | |
| outputs=[state, question_text, answer_radio, progress_bar, prev_button, result_section] | |
| ) | |
| prev_button.click( | |
| fn=lambda state: update_question(-1, state), | |
| inputs=[state], | |
| outputs=[state, question_text, answer_radio, progress_bar, prev_button] | |
| ) | |
| restart_button.click( | |
| fn=restart, | |
| outputs=[state, intro, question_section, start_button, result_section, question_text, answer_radio, progress_bar, prev_button] | |
| ) | |
| # ๋ง์ง๋ง ์ง๋ฌธ์์ ๋ค์ ๋ฒํผ ํด๋ฆญ ์ ๊ฒฐ๊ณผ ํ์ | |
| def show_result(choice, state): | |
| if choice is None: | |
| current_q = questions[state["current_question"]] | |
| return state, f"## {current_q['question']}", gr.update(), gr.update(), gr.update() | |
| # ํ์ฌ ์ง๋ฌธ๊ณผ ๊ทธ์ ๋ํ ๋ต๋ณ ์ฒ๋ฆฌ | |
| current_q = questions[state["current_question"]] | |
| scale = current_q["scale"] | |
| # ์ ์ ์ ๋ฐ์ดํธ | |
| if choice == current_q["options"][0]: # A ์ ํ | |
| if scale == "EI": | |
| state["scores"]["EI"] += 1 | |
| elif scale == "SN": | |
| state["scores"]["SN"] += 1 | |
| elif scale == "TF": | |
| state["scores"]["TF"] += 1 | |
| elif scale == "JP": | |
| state["scores"]["JP"] += 1 | |
| else: # B ์ ํ | |
| if scale == "EI": | |
| state["scores"]["EI"] -= 1 | |
| elif scale == "SN": | |
| state["scores"]["SN"] -= 1 | |
| elif scale == "TF": | |
| state["scores"]["TF"] -= 1 | |
| elif scale == "JP": | |
| state["scores"]["JP"] -= 1 | |
| # ๋ค์ ์ง๋ฌธ ๋๋ ๊ฒฐ๊ณผ๋ก ์ด๋ | |
| next_index = state["current_question"] + 1 | |
| if next_index >= len(questions): | |
| # ๋ง์ง๋ง ์ง๋ฌธ์ด๋ฉด ๊ฒฐ๊ณผ ํ์ | |
| state["completed"] = True | |
| mbti_result = calculate_mbti(state["scores"]) | |
| description = mbti_descriptions[mbti_result] | |
| result_html = f""" | |
| <div style="text-align: center; padding: 20px; background-color: #f5f5f5; border-radius: 10px; margin-bottom: 20px;"> | |
| <h2 style="color: #333; margin-bottom: 10px;">{description["title"]}</h2> | |
| <p style="font-size: 18px; margin-bottom: 20px;">{description["description"]}</p> | |
| </div> | |
| <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 30px;"> | |
| <div style="background-color: #e6f7ff; padding: 15px; border-radius: 8px;"> | |
| <h3 style="color: #0066cc; margin-bottom: 10px;">๊ฐ์ </h3> | |
| <p>{description["strengths"]}</p> | |
| </div> | |
| <div style="background-color: #fff0f0; padding: 15px; border-radius: 8px;"> | |
| <h3 style="color: #cc0000; margin-bottom: 10px;">์ฝ์ </h3> | |
| <p>{description["weaknesses"]}</p> | |
| </div> | |
| </div> | |
| <div style="background-color: #f0f8ff; padding: 15px; border-radius: 8px; margin-bottom: 20px;"> | |
| <h3 style="color: #003366; margin-bottom: 10px;">๋์ธ๊ด๊ณ ์ฑํฅ</h3> | |
| <p>{description["relationships"]}</p> | |
| </div> | |
| <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px;"> | |
| <div style="background-color: #f5f5dc; padding: 15px; border-radius: 8px;"> | |
| <h3 style="color: #8b4513; margin-bottom: 10px;">๋ํ ์ธ๋ฌผ</h3> | |
| <p>{description["famous"]}</p> | |
| </div> | |
| <div style="background-color: #f0fff0; padding: 15px; border-radius: 8px;"> | |
| <h3 style="color: #006400; margin-bottom: 10px;">์ ํฉํ ์ง์ </h3> | |
| <p>{description["careers"]}</p> | |
| </div> | |
| </div> | |
| <div style="text-align: center; margin-top: 30px; padding: 15px; background-color: #fffaf0; border-radius: 8px;"> | |
| <p style="font-style: italic; color: #666;">โป ์ด ๊ฒฐ๊ณผ๋ ๊ฐ๋จํ ์ง๋ฌธ์ ํตํ ์ฐธ๊ณ ์ฉ์ด๋ฉฐ, ์ ๋ฌธ์ ์ธ MBTI ๊ฒ์ฌ๋ ๊ณต์ธ๋ ๊ธฐ๊ด์ ํตํด ๋ฐ์ผ์๊ธฐ ๋ฐ๋๋๋ค.</p> | |
| </div> | |
| """ | |
| return state, gr.update(visible=False), gr.update(visible=True), f"## ๋น์ ์ MBTI ์ ํ์: {mbti_result}", result_html | |
| # ๋ค์ ์ง๋ฌธ์ผ๋ก ์ด๋ | |
| state["current_question"] = next_index | |
| next_q = questions[next_index] | |
| return state, gr.update(), gr.update(), gr.update(), gr.update() | |
| next_button.click( | |
| fn=show_result, | |
| inputs=[answer_radio, state], | |
| outputs=[state, question_section, result_section, result_title, result_content] | |
| ) | |
| app.launch() | |
| if __name__ == '__main__': | |
| demo.launch() |