Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -82,24 +82,27 @@ if submit_button_left:
|
|
| 82 |
# Display random rows based on selected experience level
|
| 83 |
if submit_button_left:
|
| 84 |
st.subheader("์ ํ๋ ๊ณ ๋ฏผ์?")
|
| 85 |
-
selected_row = df[selected_experience].sample(n=1)
|
|
|
|
| 86 |
with st.expander("๊ณ ๋ฏผ ๋ด์ฉ๋ณด๊ธฐ", expanded=True):
|
| 87 |
-
|
| 88 |
-
st.markdown(f"{cell_value}")
|
| 89 |
|
| 90 |
# Add advice section
|
| 91 |
st.subheader("๊ณ ๋ฏผ ์กฐ์ธํด์ฃผ๊ธฐ")
|
| 92 |
-
st.write("
|
| 93 |
advice = st.text_area(" ", height=100)
|
| 94 |
submit_button_right = st.button("์กฐ์ธ ์ ์ถํ๊ธฐ")
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
|
|
|
| 104 |
else:
|
| 105 |
-
st.
|
|
|
|
|
|
|
|
|
| 82 |
# Display random rows based on selected experience level
|
| 83 |
if submit_button_left:
|
| 84 |
st.subheader("์ ํ๋ ๊ณ ๋ฏผ์?")
|
| 85 |
+
selected_row = df[selected_experience].sample(n=1).iloc[0]
|
| 86 |
+
st.session_state['selected_concern'] = selected_row['๊ณ ๋ฏผ'] # ์ฌ๊ธฐ์ '๊ณ ๋ฏผ'์ DataFrame์ ํด๋น ์ด ์ด๋ฆ์
๋๋ค.
|
| 87 |
with st.expander("๊ณ ๋ฏผ ๋ด์ฉ๋ณด๊ธฐ", expanded=True):
|
| 88 |
+
st.markdown(selected_row['๊ณ ๋ฏผ']) # ์ธ์
์ํ์ ์ ์ฅ๋ ๊ณ ๋ฏผ ๋ด์ฉ์ ์ฌ์ฉ์์๊ฒ ๋ณด์ฌ์ค๋๋ค.
|
|
|
|
| 89 |
|
| 90 |
# Add advice section
|
| 91 |
st.subheader("๊ณ ๋ฏผ ์กฐ์ธํด์ฃผ๊ธฐ")
|
| 92 |
+
st.write("๋ค๋ฅธ ํ์ฅ๋๋ค์ ๊ณ ๋ฏผ์ ๋ํด ์กฐ์ธํด์ฃผ์๊ฒ ์ด์?")
|
| 93 |
advice = st.text_area(" ", height=100)
|
| 94 |
submit_button_right = st.button("์กฐ์ธ ์ ์ถํ๊ธฐ")
|
| 95 |
+
|
| 96 |
+
# ์กฐ์ธ ์ ์ถ ๋ฒํผ ์ฒ๋ฆฌ
|
| 97 |
+
if submit_button_right:
|
| 98 |
+
if not st.session_state.get('submitted', False): # 'submitted' ์ํ๊ฐ False์ธ ๊ฒฝ์ฐ์๋ง ์คํ
|
| 99 |
+
user_advice = advice.strip() # ์ฌ์ฉ์ ์
๋ ฅ์์ ๊ณต๋ฐฑ ์ ๊ฑฐ
|
| 100 |
+
if user_advice: # ์ฌ์ฉ์๊ฐ ์ค์ ๋ก ์กฐ์ธ์ ์
๋ ฅํ๋์ง ํ์ธ
|
| 101 |
+
selected_concern = st.session_state.get('selected_concern', '๊ณ ๋ฏผ ์์') # ์ธ์
์ํ์์ ์ ํ๋ ๊ณ ๋ฏผ ๋ด์ฉ์ ๊ฐ์ ธ์ด
|
| 102 |
+
record_advice(selected_concern, user_advice) # Google Sheets์ ๊ธฐ๋ก
|
| 103 |
+
st.session_state['submitted'] = True # 'submitted' ์ํ๋ฅผ True๋ก ์ค์ ํ์ฌ ์ค๋ณต ์ ์ถ ๋ฐฉ์ง
|
| 104 |
+
st.success("์กฐ์ธ์ด ์ฑ๊ณต์ ์ผ๋ก ์ ์ถ๋์์ต๋๋ค!")
|
| 105 |
else:
|
| 106 |
+
st.error("์กฐ์ธ์ ์
๋ ฅํด์ฃผ์ธ์.") # ์ฌ์ฉ์๊ฐ ์กฐ์ธ์ ์
๋ ฅํ์ง ์์ ๊ฒฝ์ฐ ์๋ฌ ๋ฉ์์ง ์ถ๋ ฅ
|
| 107 |
+
else:
|
| 108 |
+
st.warning("์ด๋ฏธ ์ ์ถ๋์์ต๋๋ค.") # ์ด๋ฏธ ์ ์ถ๋ ๊ฒฝ์ฐ ๊ฒฝ๊ณ ๋ฉ์์ง ์ถ๋ ฅ
|