JeongHyunsung commited on
Commit
bc889e8
ยท
verified ยท
1 Parent(s): 3b0ce16

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -79,7 +79,6 @@ def predict_emotion(text, top_k=5):
79
 
80
  tabs = st.tabs(["๊ฐ์ • ๋ถ„์„ ์ฒดํ—˜", "AI๋Š” ์–ด๋–ป๊ฒŒ ๊ฐ์ •์„ ์ดํ•ดํ• ๊นŒ?", "Few-shot Fine-tuning์ด๋ž€?", "ํ™œ์šฉ๊ณผ ์˜์˜"])
81
 
82
-
83
  with tabs[0]:
84
  st.markdown('<div class="big-title">๐ŸŽญ ํ•œ๊ตญ์–ด ๊ฐ์ • ๋ถ„์„ AI ์ฒดํ—˜</div>', unsafe_allow_html=True)
85
  st.markdown('<div class="sub-info">2025๋…„ 1ํ•™๊ธฐ ๋””์ง€ํ„ธ ์ธ๋ฌธํ•™ ์ž…๋ฌธ (SLA23501) ยท <b>Team ์ƒ๋Ÿฌ๋“œ๋ณผ</b><br>๊ฐ•์ˆ˜ํ˜„ ยท ๊น€๋™์šฐ ยท ์ •์˜ˆ์€ ยท ์ •ํ˜„์„ฑ ยท ์ตœ์ข…์œค</div>', unsafe_allow_html=True)
@@ -91,19 +90,18 @@ with tabs[0]:
91
  </div>
92
  """, unsafe_allow_html=True)
93
 
94
- if "example_text" not in st.session_state:
95
- st.session_state.example_text = ""
96
-
97
- st.text_area("โœ๏ธ ๋ฌธ์žฅ์„ ์ž…๋ ฅํ•˜์„ธ์š”:", key="example_text", height=120, placeholder="์˜ˆ: ์˜ค๋Š˜ ํ•˜๋ฃจ ์ •๋ง ํ–‰๋ณตํ–ˆ์–ด์š”.")
98
 
99
  col1, col2 = st.columns([1, 1])
100
  with col1:
101
  if st.button("๐Ÿ“Œ ์˜ˆ์‹œ ๋ฌธ์žฅ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ"):
102
- st.session_state.example_text = "์ด ์˜ํ™” ์ •๋ง ๊ฐ๋™์ ์ด์—ˆ์–ด์š”. ๋ˆˆ๋ฌผ์ด ๋‚ฌ์Šต๋‹ˆ๋‹ค."
 
 
103
 
104
  with col2:
105
  if st.button("๐Ÿ” ๊ฐ์ • ์˜ˆ์ธกํ•˜๊ธฐ"):
106
- text = st.session_state.example_text
107
  if text.strip():
108
  results, full_probs = predict_emotion(text)
109
  st.subheader("๐Ÿ“Š ์ƒ์œ„ ๊ฐ์ • ๊ฒฐ๊ณผ")
@@ -114,6 +112,10 @@ with tabs[0]:
114
  else:
115
  st.warning("๋ฌธ์žฅ์„ ๋จผ์ € ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.")
116
 
 
 
 
 
117
 
118
 
119
 
 
79
 
80
  tabs = st.tabs(["๊ฐ์ • ๋ถ„์„ ์ฒดํ—˜", "AI๋Š” ์–ด๋–ป๊ฒŒ ๊ฐ์ •์„ ์ดํ•ดํ• ๊นŒ?", "Few-shot Fine-tuning์ด๋ž€?", "ํ™œ์šฉ๊ณผ ์˜์˜"])
81
 
 
82
  with tabs[0]:
83
  st.markdown('<div class="big-title">๐ŸŽญ ํ•œ๊ตญ์–ด ๊ฐ์ • ๋ถ„์„ AI ์ฒดํ—˜</div>', unsafe_allow_html=True)
84
  st.markdown('<div class="sub-info">2025๋…„ 1ํ•™๊ธฐ ๋””์ง€ํ„ธ ์ธ๋ฌธํ•™ ์ž…๋ฌธ (SLA23501) ยท <b>Team ์ƒ๋Ÿฌ๋“œ๋ณผ</b><br>๊ฐ•์ˆ˜ํ˜„ ยท ๊น€๋™์šฐ ยท ์ •์˜ˆ์€ ยท ์ •ํ˜„์„ฑ ยท ์ตœ์ข…์œค</div>', unsafe_allow_html=True)
 
90
  </div>
91
  """, unsafe_allow_html=True)
92
 
93
+ if "text_input" not in st.session_state:
94
+ st.session_state.text_input = ""
 
 
95
 
96
  col1, col2 = st.columns([1, 1])
97
  with col1:
98
  if st.button("๐Ÿ“Œ ์˜ˆ์‹œ ๋ฌธ์žฅ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ"):
99
+ st.session_state.text_input = "์ด ์˜ํ™” ์ •๋ง ๊ฐ๋™์ ์ด์—ˆ์–ด์š”. ๋ˆˆ๋ฌผ์ด ๋‚ฌ์Šต๋‹ˆ๋‹ค."
100
+
101
+ text = st.text_area("โœ๏ธ ๋ฌธ์žฅ์„ ์ž…๋ ฅํ•˜์„ธ์š”:", value=st.session_state.text_input, height=120, placeholder="์˜ˆ: ์˜ค๋Š˜ ํ•˜๋ฃจ ์ •๋ง ํ–‰๋ณตํ–ˆ์–ด์š”.")
102
 
103
  with col2:
104
  if st.button("๐Ÿ” ๊ฐ์ • ์˜ˆ์ธกํ•˜๊ธฐ"):
 
105
  if text.strip():
106
  results, full_probs = predict_emotion(text)
107
  st.subheader("๐Ÿ“Š ์ƒ์œ„ ๊ฐ์ • ๊ฒฐ๊ณผ")
 
112
  else:
113
  st.warning("๋ฌธ์žฅ์„ ๋จผ์ € ์ž…๋ ฅํ•ด์ฃผ์„ธ์š”.")
114
 
115
+ # ์ตœ์‹  text ์œ ์ง€
116
+ st.session_state.text_input = text
117
+
118
+
119
 
120
 
121