taeyeol commited on
Commit
c1d7a8d
ยท
verified ยท
1 Parent(s): 981ed50

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -20,10 +20,15 @@ mbti_interpretations = {
20
  "ESTP": "์‚ฌ์—…๊ฐ€: ์—๋„ˆ์ง€๊ฐ€ ๋„˜์น˜๊ณ  ๋Œ€๋‹ดํ•˜๋ฉฐ, ํ–‰๋™์œผ๋กœ ์ƒ๊ฐ์„ ์˜ฎ๊น๋‹ˆ๋‹ค."
21
  }
22
 
23
- def calculate_mbti(q1, q2, q3, q4, q5, q6, q7, q8, q9, q10):
24
  # ๋‹จ์ˆœํ™”๋œ MBTI ์œ ํ˜• ๊ณ„์‚ฐ ๋กœ์ง
 
 
25
  mbti_type = "INTJ" # ์˜ˆ์‹œ๋กœ INTJ๋ฅผ ์„ ํƒ
26
- return mbti_type, mbti_interpretations[mbti_type]
 
 
 
27
 
28
  # ์งˆ๋ฌธ ๋ฆฌ์ŠคํŠธ
29
  questions = [
@@ -42,9 +47,10 @@ questions = [
42
  # Gradio ์•ฑ ์ •์˜
43
  with gr.Blocks() as app:
44
  gr.Markdown("# MBTI ์ง„๋‹จ ํ…Œ์ŠคํŠธ")
45
- answers = [gr.Radio(["์˜ต์…˜ 1", "์˜ต์…˜ 2", "์˜ต์…˜ 3"], label=question) for question in questions]
 
46
  submit_button = gr.Button("๊ฒฐ๊ณผ ๋ณด๊ธฐ")
47
- output_mbti, output_interpretation = gr.Textbox(label="๋‹น์‹ ์˜ MBTI ์œ ํ˜•"), gr.Textbox(label="์œ ํ˜• ํ•ด์„")
48
 
49
  submit_button.click(fn=calculate_mbti, inputs=answers, outputs=[output_mbti, output_interpretation])
50
 
 
20
  "ESTP": "์‚ฌ์—…๊ฐ€: ์—๋„ˆ์ง€๊ฐ€ ๋„˜์น˜๊ณ  ๋Œ€๋‹ดํ•˜๋ฉฐ, ํ–‰๋™์œผ๋กœ ์ƒ๊ฐ์„ ์˜ฎ๊น๋‹ˆ๋‹ค."
21
  }
22
 
23
+ def calculate_mbti(*args):
24
  # ๋‹จ์ˆœํ™”๋œ MBTI ์œ ํ˜• ๊ณ„์‚ฐ ๋กœ์ง
25
+ # args๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ๊ฐ ์งˆ๋ฌธ์— ๋Œ€ํ•ด ์„ ํƒํ•œ ์˜ต์…˜๋“ค์˜ ๋ฆฌ์ŠคํŠธ
26
+ # ์—ฌ๊ธฐ์„œ๋Š” ๋‹จ์ˆœํ™”๋ฅผ ์œ„ํ•ด ํ•ญ์ƒ "INTJ"๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋„๋ก ์„ค์ •
27
  mbti_type = "INTJ" # ์˜ˆ์‹œ๋กœ INTJ๋ฅผ ์„ ํƒ
28
+ # MBTI ์œ ํ˜•๊ณผ ํ•ด์„์„ ๋ฐ˜ํ™˜
29
+ interpretation = mbti_interpretations[mbti_type]
30
+ detailed_interpretation = f"{mbti_type}: {interpretation}\n\n์ง„๋‹จ ํ…Œ์ŠคํŠธ ๋‚ด์šฉ ์ถ”๊ฐ€:\n{mbti_type} ์œ ํ˜•์€ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ๋ฆฌ๋”์‹ญ์„ ๋ฐœํœ˜ํ•˜๋ฉฐ, ๋ณต์žกํ•œ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š” ๋ฐ ๋Šฅ์ˆ™ํ•ฉ๋‹ˆ๋‹ค. ๋…๋ฆฝ์ ์ธ ์‚ฌ๊ณ ์™€ ๊ฐ•ํ•œ ์˜์ง€๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์œผ๋ฉฐ, ์ž์‹ ์˜ ๋น„์ „์„ ํ˜„์‹ค๋กœ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด ๋Š์ž„์—†์ด ๋…ธ๋ ฅํ•ฉ๋‹ˆ๋‹ค."
31
+ return mbti_type, detailed_interpretation
32
 
33
  # ์งˆ๋ฌธ ๋ฆฌ์ŠคํŠธ
34
  questions = [
 
47
  # Gradio ์•ฑ ์ •์˜
48
  with gr.Blocks() as app:
49
  gr.Markdown("# MBTI ์ง„๋‹จ ํ…Œ์ŠคํŠธ")
50
+ with gr.Row():
51
+ answers = [gr.Radio(["์˜ต์…˜ 1", "์˜ต์…˜ 2", "์˜ต์…˜ 3", "์˜ต์…˜ 4"], label=question) for question in questions] # ์˜ต์…˜ ์ถ”๊ฐ€
52
  submit_button = gr.Button("๊ฒฐ๊ณผ ๋ณด๊ธฐ")
53
+ output_mbti, output_interpretation = gr.Textbox(label="๋‹น์‹ ์˜ MBTI ์œ ํ˜•"), gr.Textbox(label="์œ ํ˜• ํ•ด์„ ๋ฐ ์ง„๋‹จ ํ…Œ์ŠคํŠธ ๋‚ด์šฉ", lines=10)
54
 
55
  submit_button.click(fn=calculate_mbti, inputs=answers, outputs=[output_mbti, output_interpretation])
56