randmimc commited on
Commit
52dbcec
ยท
verified ยท
1 Parent(s): 50b8fa6

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +11 -4
src/streamlit_app.py CHANGED
@@ -88,13 +88,20 @@ def anormal(df, col_name, warning, text_input, audio_base64):
88
  st.markdown(audio_html, unsafe_allow_html=True)
89
 
90
  # ์„œ๋น„์Šค ์‹คํ–‰
91
- selected_text = st.selectbox("๋ฐ์ดํ„ฐ๋ฅผ ์„ ํƒํ•˜์„ธ์š”", options)
 
 
92
 
93
- if selected_text == "":
 
 
 
 
 
94
  none_temp(placeholder)
95
- elif selected_text == "2024-09-26":
96
  normal(placeholder, df, "ECU_DPFSoot")
97
- else:
98
  audio_base64 = tts_engine(warning+" "+text_input)
99
  anormal(placeholder, df, "ECU_DPFSoot", warning, text_input, audio_base64)
100
 
 
88
  st.markdown(audio_html, unsafe_allow_html=True)
89
 
90
  # ์„œ๋น„์Šค ์‹คํ–‰
91
+ # 1. session_state ์ดˆ๊ธฐํ™” (์•ฑ์ด ์ฒ˜์Œ ์‹คํ–‰๋  ๋•Œ๋งŒ ์ž‘๋™)
92
+ if 'selection' not in st.session_state:
93
+ st.session_state.selection = ""
94
 
95
+ st.selectbox(
96
+ "์ง„๋‹จํ•  ๋ฐ์ดํ„ฐ๋ฅผ ์„ ํƒํ•˜์„ธ์š”:",
97
+ options=["", "2024-08-24", "2024-09-26"],
98
+ key='selection' # ์ด key๊ฐ€ st.session_state.selection๊ณผ ์—ฐ๊ฒฐ๋ฉ๋‹ˆ๋‹ค.
99
+ )
100
+ if st.session_state.selection == "":
101
  none_temp(placeholder)
102
+ elif st.session_state.selection == "2024-09-26":
103
  normal(placeholder, df, "ECU_DPFSoot")
104
+ else: # "2024-08-24"
105
  audio_base64 = tts_engine(warning+" "+text_input)
106
  anormal(placeholder, df, "ECU_DPFSoot", warning, text_input, audio_base64)
107