File size: 1,213 Bytes
b1026c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
from BART_utils import get_prob, judge_mbti, compute_score, mbti_translator, plot_mbti, device


st.title("MBTI ๋ฒˆ์—ญ๊ธฐ")
if device == "cpu":
    processor = "๐Ÿ–ฅ๏ธ"
else:
    processor = "๐Ÿ’ฝ"
st.subheader("Running on {}".format(device + processor))

st.header("๐Ÿ’ป๋‚˜๋Š” ์˜ค๋Š˜ ์–ด๋–ค MBTI์ฒ˜๋Ÿผ ๋งํ•˜๊ณ , ์‚ด์•˜์„๊นŒ?")
st.write("๐Ÿค—๋ฌธ์žฅ์„ ์ž…๋ ฅํ•˜๋ฉด, ์ด๋ฅผ ๋ถ„์„ํ•ด์„œ MBTI๋ฅผ ์ถœ๋ ฅํ•ด์ค๋‹ˆ๋‹ค. ์•„์ง์€ ์˜์–ด๋งŒ ์ง€์›๋ฉ๋‹ˆ๋‹ค!")
st.header("๐Ÿค”์ž‘๋™ ์›๋ฆฌ๋Š”?:")
st.write("Faceook ์˜ Zero-Shot NLI ๋ชจ๋ธ์„ ํ†ตํ•ด ๋ฌธ์žฅ๊ณผ ๋‹จ์–ด์˜ ์—ฐ๊ด€์„ฑ์„ ์ถ”๋ก ํ•ฉ๋‹ˆ๋‹ค.")
st.write("๋ชจ๋ธ ๋ฐ ํ”„๋กœ์ ํŠธ์— ๋Œ€ํ•ด์„œ ์ž์„ธํžˆ ์•Œ๊ณ ์‹ถ๋‹ค๋ฉด: https://github.com/ethHong/mbti_translator_demo")

user_input = st.text_input("๐Ÿ‘‡๐Ÿ‘‡๋ฌธ์žฅ์„ ์ž…๋ ฅํ•˜๋ฉด MBTI๊ฐ€ ๋‚˜์˜ต๋‹ˆ๋‹ค!", "I stayed home all day")
submit = st.button("๋ฌธ์žฅ ์ƒ์„ฑ")

if submit:
    with st.spinner("AI๊ฐ€ ๊ฒฐ๊ณผ๋ฅผ ๋ถ„์„ํ•˜๋Š” ์ค‘์ด์—์š”..."):
        output_mbti, output_ratio = mbti_translator(
            user_input)

    st.success("Success")
    st.subheader("๐Ÿค”์ฐธ ์ด MBTI๊ฐ™์€ ๋ฌธ์žฅ์ด๊ตฐ์š”๐ŸŽ‰ : " + output_mbti)

    for result in output_ratio:
        plot_mbti(result)