Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +11 -34
src/streamlit_app.py
CHANGED
|
@@ -67,38 +67,15 @@ def assistant_message_style(assistant_icon_path, answer):
|
|
| 67 |
<div class="chat-bubble assistant-bubble">{answer}</div>
|
| 68 |
</div>"""
|
| 69 |
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
else:
|
| 74 |
-
st.markdown(assistant_message_style(assistant_icon_path, message["content"]), unsafe_allow_html=True)
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
# 사용자 질문 화면에 표시
|
| 86 |
-
st.markdown(user_message_style(prompt), unsafe_allow_html=True)
|
| 87 |
-
|
| 88 |
-
# 인증
|
| 89 |
-
if st.session_state.approval_state == "require":
|
| 90 |
-
if prompt.lower() == "yes":
|
| 91 |
-
st.session_state.approval_state = "approved"
|
| 92 |
-
response = "이제 사용이 가능합니다. 단, 모델 크기가 작은 모델이여서 성능이 기대에 못미칠 수 있습니다."
|
| 93 |
-
else:
|
| 94 |
-
response = "인증에 실패하였습니다. 다시 yes를 입력해 주세요"
|
| 95 |
-
# 응답 생성
|
| 96 |
-
else:
|
| 97 |
-
result = re.sub(r'\s+', ' ', prompt)
|
| 98 |
-
summarized = pipe(result)
|
| 99 |
-
response = summarized[0]["summary_text"]
|
| 100 |
-
|
| 101 |
-
# 어시스턴스의 메세지를 세션에 저장
|
| 102 |
-
st.session_state.messages.append({"role": "assistant", "content": response})
|
| 103 |
-
# 어시스턴스의 메세지를 화면에 표시
|
| 104 |
-
st.markdown(assistant_message_style(assistant_icon_path, response), unsafe_allow_html=True)
|
|
|
|
| 67 |
<div class="chat-bubble assistant-bubble">{answer}</div>
|
| 68 |
</div>"""
|
| 69 |
|
| 70 |
+
# 드롭다운 메뉴
|
| 71 |
+
st.markdown("---")
|
| 72 |
+
st.subheader("요약할 기사 선택")
|
|
|
|
|
|
|
| 73 |
|
| 74 |
+
options = [
|
| 75 |
+
"",
|
| 76 |
+
"yes",
|
| 77 |
+
"대한민국은 최근 AI 기술에 대한 관심이 급증하고 있다. 많은 기업이 AI 도입을 가속화하며 디지털 전환에 박차를 가하고 있다.",
|
| 78 |
+
"오늘 열린 G7 정상회의에서는 글로벌 경제 회복과 기후 변화 대응을 위한 논의가 이어졌다.",
|
| 79 |
+
"한국은행은 기준금리를 동결하면서도 물가 상승에 대한 우려를 나타냈다."
|
| 80 |
+
]
|
| 81 |
+
selected_text = st.selectbox("기사 문장을 선택하세요", options)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|