Yescia commited on
Commit
75b58db
ยท
verified ยท
1 Parent(s): c02ed13

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import streamlit as st
2
  import requests
3
  import random
 
4
 
5
  # -----------------------------
6
  # ๐Ÿ”ง ํ•จ์ˆ˜ ์ •์˜ ์˜์—ญ
@@ -47,6 +48,8 @@ def chat_with_solar(user_question, history, api_key):
47
  # -----------------------------
48
  # ๐Ÿ–ฅ๏ธ Streamlit UI ์˜์—ญ
49
  # -----------------------------
 
 
50
 
51
  st.set_page_config(page_title="Decision Tree Chatbot Activity", layout="wide")
52
 
@@ -96,6 +99,7 @@ with col1:
96
  with col2:
97
  st.subheader("๐Ÿ“ ๋ฉ”๋ชจ์žฅ: ๋‚˜์˜ ์ดํ•ด ๊ธฐ๋ก")
98
  notes = st.text_area("์˜ค๋Š˜ ์•Œ๊ฒŒ ๋œ ์ ์ด๋‚˜ ๊ถ๊ธˆํ•œ ์ ์„ ์ •๋ฆฌํ•ด๋ณด์„ธ์š”:")
 
99
  if st.button("๋žœ๋ค ์งˆ๋ฌธ ์ œ์•ˆ๋ฐ›๊ธฐ"):
100
  sample_questions = [
101
  "์˜์‚ฌ๊ฒฐ์ •๋‚˜๋ฌด๊ฐ€ ๋ญ์•ผ?",
@@ -106,5 +110,13 @@ with col2:
106
  ]
107
  st.info(f"์˜ˆ์‹œ ์งˆ๋ฌธ: '{random.choice(sample_questions)}'")
108
 
 
 
 
 
 
 
 
 
109
  st.markdown("---")
110
  st.markdown("Made with โค๏ธ using Solar Pro API ยท Upstage ยท Streamlit")
 
1
  import streamlit as st
2
  import requests
3
  import random
4
+ from datetime import datetime
5
 
6
  # -----------------------------
7
  # ๐Ÿ”ง ํ•จ์ˆ˜ ์ •์˜ ์˜์—ญ
 
48
  # -----------------------------
49
  # ๐Ÿ–ฅ๏ธ Streamlit UI ์˜์—ญ
50
  # -----------------------------
51
+ today = datetime.now().strftime("%Y-%m-%d")
52
+ filename= f"{today}_studynote.txt"
53
 
54
  st.set_page_config(page_title="Decision Tree Chatbot Activity", layout="wide")
55
 
 
99
  with col2:
100
  st.subheader("๐Ÿ“ ๋ฉ”๋ชจ์žฅ: ๋‚˜์˜ ์ดํ•ด ๊ธฐ๋ก")
101
  notes = st.text_area("์˜ค๋Š˜ ์•Œ๊ฒŒ ๋œ ์ ์ด๋‚˜ ๊ถ๊ธˆํ•œ ์ ์„ ์ •๋ฆฌํ•ด๋ณด์„ธ์š”:")
102
+
103
  if st.button("๋žœ๋ค ์งˆ๋ฌธ ์ œ์•ˆ๋ฐ›๊ธฐ"):
104
  sample_questions = [
105
  "์˜์‚ฌ๊ฒฐ์ •๋‚˜๋ฌด๊ฐ€ ๋ญ์•ผ?",
 
110
  ]
111
  st.info(f"์˜ˆ์‹œ ์งˆ๋ฌธ: '{random.choice(sample_questions)}'")
112
 
113
+ if notes:
114
+ st.download_button(
115
+ label="๐Ÿ“ฅ ๋ฉ”๋ชจ ๋‹ค์šด๋กœ๋“œ(txt)",
116
+ data=notes,
117
+ file_name= filename
118
+ mime="text/plain"
119
+ )
120
+
121
  st.markdown("---")
122
  st.markdown("Made with โค๏ธ using Solar Pro API ยท Upstage ยท Streamlit")