Spaces:
Sleeping
Sleeping
Hong
commited on
Commit
ยท
b1026c7
1
Parent(s):
1ca2d74
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from BART_utils import get_prob, judge_mbti, compute_score, mbti_translator, plot_mbti, device
|
3 |
+
|
4 |
+
|
5 |
+
st.title("MBTI ๋ฒ์ญ๊ธฐ")
|
6 |
+
if device == "cpu":
|
7 |
+
processor = "๐ฅ๏ธ"
|
8 |
+
else:
|
9 |
+
processor = "๐ฝ"
|
10 |
+
st.subheader("Running on {}".format(device + processor))
|
11 |
+
|
12 |
+
st.header("๐ป๋๋ ์ค๋ ์ด๋ค MBTI์ฒ๋ผ ๋งํ๊ณ , ์ด์์๊น?")
|
13 |
+
st.write("๐ค๋ฌธ์ฅ์ ์
๋ ฅํ๋ฉด, ์ด๋ฅผ ๋ถ์ํด์ MBTI๋ฅผ ์ถ๋ ฅํด์ค๋๋ค. ์์ง์ ์์ด๋ง ์ง์๋ฉ๋๋ค!")
|
14 |
+
st.header("๐ค์๋ ์๋ฆฌ๋?:")
|
15 |
+
st.write("Faceook ์ Zero-Shot NLI ๋ชจ๋ธ์ ํตํด ๋ฌธ์ฅ๊ณผ ๋จ์ด์ ์ฐ๊ด์ฑ์ ์ถ๋ก ํฉ๋๋ค.")
|
16 |
+
st.write("๋ชจ๋ธ ๋ฐ ํ๋ก์ ํธ์ ๋ํด์ ์์ธํ ์๊ณ ์ถ๋ค๋ฉด: https://github.com/ethHong/mbti_translator_demo")
|
17 |
+
|
18 |
+
user_input = st.text_input("๐๐๋ฌธ์ฅ์ ์
๋ ฅํ๋ฉด MBTI๊ฐ ๋์ต๋๋ค!", "I stayed home all day")
|
19 |
+
submit = st.button("๋ฌธ์ฅ ์์ฑ")
|
20 |
+
|
21 |
+
if submit:
|
22 |
+
with st.spinner("AI๊ฐ ๊ฒฐ๊ณผ๋ฅผ ๋ถ์ํ๋ ์ค์ด์์..."):
|
23 |
+
output_mbti, output_ratio = mbti_translator(
|
24 |
+
user_input)
|
25 |
+
|
26 |
+
st.success("Success")
|
27 |
+
st.subheader("๐ค์ฐธ ์ด MBTI๊ฐ์ ๋ฌธ์ฅ์ด๊ตฐ์๐ : " + output_mbti)
|
28 |
+
|
29 |
+
for result in output_ratio:
|
30 |
+
plot_mbti(result)
|