SUNGJIN LEE commited on
Commit
9382be8
1 Parent(s): 5e2bdcf

로그인 페이지 개선

Browse files
Files changed (3) hide show
  1. .gitignore +1 -0
  2. app.py +12 -10
  3. pages/Recommendation System.py +3 -3
.gitignore CHANGED
@@ -1,3 +1,4 @@
1
  generate_keys.py
2
  __pycache__/
3
  .streamlit/secrets.toml
 
 
1
  generate_keys.py
2
  __pycache__/
3
  .streamlit/secrets.toml
4
+ config.yaml
app.py CHANGED
@@ -5,16 +5,18 @@ if "logged_in" not in st.session_state:
5
  st.session_state.logged_in = False
6
 
7
  def login():
8
- st.write("### Log in")
9
- username = st.text_input("Username", type="default")
10
- password = st.text_input("Password", type="password")
11
- login = st.button("Login")
12
- if login:
13
- if username== os.getenv("username") and password == os.getenv("password"):
14
- st.session_state.logged_in = True
15
- st.rerun()
16
- else:
17
- st.error("Incorrect username or password")
 
 
18
 
19
  def logout():
20
  st.session_state.logged_in = False
 
5
  st.session_state.logged_in = False
6
 
7
  def login():
8
+ with st.form("Login"):
9
+ st.write("### Login")
10
+ username = st.text_input("Username", type="default")
11
+ password = st.text_input("Password", type="password")
12
+ login = st.form_submit_button("Login")
13
+ if login:
14
+ # if username== st.secrets["auth"]["username"] and password == st.secrets["auth"]["password"]:
15
+ if username== os.getenv("username") and password == os.getenv("password"):
16
+ st.session_state.logged_in = True
17
+ st.rerun()
18
+ else:
19
+ st.error("Incorrect username or password")
20
 
21
  def logout():
22
  st.session_state.logged_in = False
pages/Recommendation System.py CHANGED
@@ -74,9 +74,9 @@ def load_and_predict(model_name, df_map, timestamp_input, frequencies, progress_
74
  if model_name == 'Rule-based':
75
  for idx, row in df_map.iterrows():
76
  if timestamp_input.hour < 6 or timestamp_input.hour > 22:
77
- recommended_cell_states[freq][row['enbid_pci']] = 'OFF'
78
  else:
79
- recommended_cell_states[freq][row['enbid_pci']] = 'ON'
80
  if progress_callback:
81
  progress_callback(10 + 80 * (idx + 1) // len(df_map))
82
 
@@ -123,7 +123,7 @@ if st.session_state.run_button_clicked:
123
  # 선택된 주파수의 상태 표시
124
  for freq in frequencies_to_check:
125
  status = recommended_cell_states[freq].get(matching_enbid_pci, 'Unknown')
126
- color = '#D32F2F' if status == 'OFF' else '#1976D2' # 빨간색 (OFF) / 파란색 (ON)
127
 
128
  st.markdown(f"""
129
  <div style="background-color: #f0f4f8; padding: 20px; border-radius: 10px; border: 1px solid #ccc; margin-bottom: 10px;">
 
74
  if model_name == 'Rule-based':
75
  for idx, row in df_map.iterrows():
76
  if timestamp_input.hour < 6 or timestamp_input.hour > 22:
77
+ recommended_cell_states[freq][row['enbid_pci']] = '0'
78
  else:
79
+ recommended_cell_states[freq][row['enbid_pci']] = '1'
80
  if progress_callback:
81
  progress_callback(10 + 80 * (idx + 1) // len(df_map))
82
 
 
123
  # 선택된 주파수의 상태 표시
124
  for freq in frequencies_to_check:
125
  status = recommended_cell_states[freq].get(matching_enbid_pci, 'Unknown')
126
+ color = '#D32F2F' if status == '0' else '#1976D2' # 빨간색 (OFF) / 파란색 (ON)
127
 
128
  st.markdown(f"""
129
  <div style="background-color: #f0f4f8; padding: 20px; border-radius: 10px; border: 1px solid #ccc; margin-bottom: 10px;">