File size: 2,112 Bytes
715b21c
 
ae1cb57
b6a7579
ae1cb57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ce0b9c1
ae1cb57
 
 
 
ce0b9c1
ae1cb57
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import gradio as gr

def get_input():
    return gr.components.Textbox(lines=20, placeholder="MBTI 진단을 위한 질문에 답변하세요.")

input_ui = get_input()

def diagnose_mbti(input):
    extroverted = "E" in input
    intuitive = "N" in input
    thinking = "T" in input
    judging = "J" in input

    if extroverted and intuitive and thinking and judging:
        return "INTJ"
    elif extroverted and intuitive and thinking and not judging:
        return "ENTP"
    elif extroverted and intuitive and not thinking and judging:
        return "ENFJ"
    elif extroverted and intuitive and not thinking and not judging:
        return "ENTP"
    elif extroverted and not intuitive and thinking and judging:
        return "ESTJ"
    elif extroverted and not intuitive and thinking and not judging:
        return "ESTP"
    elif extroverted and not intuitive and not thinking and judging:
        return "ESFJ"
    elif extroverted and not intuitive and not thinking and not judging:
        return "ESFP"
    elif not extroverted and intuitive and thinking and judging:
        return "INTJ"
    elif not extroverted and intuitive and thinking and not judging:
        return "INTP"
    elif not extroverted and intuitive and not thinking and judging:
        return "INFJ"
    elif not extroverted and intuitive and not thinking and not judging:
        return "INFP"
    elif not extroverted and not intuitive and thinking and judging:
        return "ISTJ"
    elif not extroverted and not intuitive and thinking and not judging:
        return "ISTP"
    elif not extroverted and not intuitive and not thinking and judging:
        return "ISFJ"
    elif not extroverted and not intuitive and not thinking and not judging:
        return "ISFP"

diagnose_ui = gr.Function(fn=diagnose_mbti, inputs=input_ui, outputs="text", name="MBTI 유형 진단")

def print_result(mbti):
    return f" tada! Your MBTI type is {mbti}."

output_ui = gr.Function(fn=print_result, inputs=diagnose_ui, outputs="text", name="결과 출력")

gr.Interface(fn=output_ui, inputs=input_ui, outputs="text").launch()