Hong commited on
Commit
b1026c7
โ€ข
1 Parent(s): 1ca2d74

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -0
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)