soojeongcrystal commited on
Commit
67d55a4
·
verified ·
1 Parent(s): afd04e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -12
app.py CHANGED
@@ -97,16 +97,16 @@ if submit_button_left:
97
  advice = st.text_area(" ", height=100)
98
  submit_button_right = st.button("조언 제출하기")
99
 
100
- # 조언 제출 버튼 처리
101
- if submit_button_right:
102
- if not st.session_state.get('submitted', False): # 'submitted' 상태가 False인 경우에만 실행
103
- user_advice = advice.strip() # 사용자 입력에서 공백 제거
104
- if user_advice: # 사용자가 실제로 조언을 입력했는지 확인
105
- selected_concern = st.session_state.get('selected_concern', '고민 없음') # 세션 상태에서 선택된 고민 내용을 가져옴
106
- record_advice(selected_concern, user_advice) # Google Sheets에 기록
107
- st.session_state['submitted'] = True # 'submitted' 상태를 True로 설정하여 중복 제출 방지
108
- st.success("조언이 성공적으로 제출되었습니다!")
 
 
109
  else:
110
- st.error("조언을 입력해주세요.") # 사용자가 조언을 입력하지 않은 경우 에러 메시지 출력
111
- else:
112
- st.warning("이미 제출되었습니다.") # 이미 제출된 경우 경고 메시지 출력
 
97
  advice = st.text_area(" ", height=100)
98
  submit_button_right = st.button("조언 제출하기")
99
 
100
+ # 조언 제출 버튼 처리
101
+ if submit_button_right:
102
+ if not st.session_state.get('submitted', False): # 'submitted' 상태가 False인 경우에만 실행
103
+ user_advice = advice.strip() # 사용자 입력에서 공백 제거
104
+ if user_advice: # 사용자가 실제로 조언을 입력했는지 확인
105
+ selected_concern = st.session_state.get('selected_concern', '고민 없음') # 세션 상태에서 선택된 고민 내용을 가져옴
106
+ record_advice(selected_concern, user_advice) # Google Sheets에 기록
107
+ st.session_state['submitted'] = True # 'submitted' 상태를 True로 설정하여 중복 제출 방지
108
+ st.success("조언이 성공적으로 제출되었습니다!")
109
+ else:
110
+ st.error("조언을 입력해주세요.") # 사용자가 조언을 입력하지 않은 경우 에러 메시지 출력
111
  else:
112
+ st.warning("이미 제출되었습니다.") # 이미 제출된 경우 경고 메시지 출력