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

페이지 구조 개선

Browse files
.streamlit/config.toml ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [server]
2
+ maxUploadSize = 1000
3
+ maxMessageSize = 1000
app.py CHANGED
@@ -5,6 +5,7 @@ if "logged_in" not in st.session_state:
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")
@@ -31,6 +32,10 @@ Home = st.Page(
31
  About = st.Page(
32
  "pages/About.py", title="About", icon=":material/info:"
33
  )
 
 
 
 
34
  Dashboard = st.Page(
35
  "pages/Dashboard.py", title="Dashboard", icon=":material/dashboard:"
36
  )
@@ -42,8 +47,9 @@ Recommendation_System = st.Page(
42
  if st.session_state.logged_in:
43
  pg = st.navigation(
44
  {
45
- "": [Home, logout_page, About],
46
- "System" : [Dashboard, Recommendation_System]
 
47
  }
48
  )
49
  else:
 
5
  st.session_state.logged_in = False
6
 
7
  def login():
8
+ st.write("# SKT AI Fellowship Team ASAP 👋")
9
  with st.form("Login"):
10
  st.write("### Login")
11
  username = st.text_input("Username", type="default")
 
32
  About = st.Page(
33
  "pages/About.py", title="About", icon=":material/info:"
34
  )
35
+
36
+ # Data = st.Page(
37
+ # "pages/Data.py", title="Data", icon=":material/data_usage:"
38
+ # )
39
  Dashboard = st.Page(
40
  "pages/Dashboard.py", title="Dashboard", icon=":material/dashboard:"
41
  )
 
47
  if st.session_state.logged_in:
48
  pg = st.navigation(
49
  {
50
+ "": [Home, About],
51
+ "System" : [Data, Dashboard, Recommendation_System],
52
+ "Account": [logout_page]
53
  }
54
  )
55
  else:
data.py CHANGED
@@ -16,6 +16,9 @@ def load_data():
16
  dataset = load_dataset('skt-asap/busan-poc-dataset', data_files=data_files, token=token)
17
  df = dataset['train'].to_pandas()
18
 
 
 
 
19
  df['ru_svc_lat_val'] = df['ru_svc_lat_val'].astype(float)
20
  df['ru_svc_lng_val'] = df['ru_svc_lng_val'].astype(float)
21
 
 
16
  dataset = load_dataset('skt-asap/busan-poc-dataset', data_files=data_files, token=token)
17
  df = dataset['train'].to_pandas()
18
 
19
+ df.fillna(0, inplace=True)
20
+ df.drop(columns=['Unnamed: 0'], inplace=True)
21
+
22
  df['ru_svc_lat_val'] = df['ru_svc_lat_val'].astype(float)
23
  df['ru_svc_lng_val'] = df['ru_svc_lng_val'].astype(float)
24
 
pages/About.py CHANGED
@@ -3,10 +3,6 @@ from streamlit.logger import get_logger
3
 
4
  LOGGER = get_logger(__name__)
5
 
6
- st.set_page_config(
7
- page_title="About"
8
- )
9
-
10
  st.markdown(
11
  """
12
  ##### *🚀 Team ASAP은 네트워크의 에너지 소비를 줄이고 탄소 배출을 감소시키기 위한 AI 알고리즘을 개발하고 있습니다. 우리의 목표는 모바일 네트워크에서 에너지 효율성을 극대화하여 지속 가능한 발전을 이루는 것입니다.*
 
3
 
4
  LOGGER = get_logger(__name__)
5
 
 
 
 
 
6
  st.markdown(
7
  """
8
  ##### *🚀 Team ASAP은 네트워크의 에너지 소비를 줄이고 탄소 배출을 감소시키기 위한 AI 알고리즘을 개발하고 있습니다. 우리의 목표는 모바일 네트워크에서 에너지 효율성을 극대화하여 지속 가능한 발전을 이루는 것입니다.*
pages/Dashboard.py CHANGED
@@ -6,9 +6,7 @@ import map
6
  import js
7
  import chart
8
 
9
- st.set_page_config(page_title="Dashboard",
10
- layout="wide",
11
- page_icon="🗺️")
12
 
13
  with st.sidebar:
14
  with st.spinner("데이터 로딩 중..."):
 
6
  import js
7
  import chart
8
 
9
+ st.set_page_config(layout="wide")
 
 
10
 
11
  with st.sidebar:
12
  with st.spinner("데이터 로딩 중..."):
pages/Data.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ from datasets import load_dataset
4
+ import data
5
+ import seaborn as sns
6
+
7
+ st.set_page_config(layout="wide")
8
+
9
+ with st.spinner("데이터 로딩 중..."):
10
+ df, df_map = data.load_data()
11
+ st.dataframe(df)
12
+
13
+ st.title("Data Exploration")
14
+
15
+ st.write("### 데이터 요약")
16
+ st.write(df.describe())
17
+
18
+ st.write("### 데이터 시각화")
19
+ sns.pairplot(df)
20
+ st.pyplot()
pages/Home.py CHANGED
@@ -4,10 +4,5 @@ import yaml
4
 
5
  LOGGER = get_logger(__name__)
6
 
7
- st.set_page_config(
8
- page_title="SKT AI Fellowship Team ASAP",
9
- page_icon="📡",
10
- layout="centered"
11
- )
12
-
13
  st.write("# SKT AI Fellowship Team ASAP 👋")
 
 
4
 
5
  LOGGER = get_logger(__name__)
6
 
 
 
 
 
 
 
7
  st.write("# SKT AI Fellowship Team ASAP 👋")
8
+
pages/Recommendation System.py CHANGED
@@ -5,12 +5,8 @@ from streamlit_folium import st_folium
5
  import map_recommend
6
  import data
7
 
8
- # Streamlit 페이지 설정
9
- st.set_page_config(page_title="Frequency Off Recommendation System",
10
- layout="centered",
11
- page_icon="📡")
12
 
13
- # 세션 상태 초기화
14
  if 'run_button_clicked' not in st.session_state:
15
  st.session_state.run_button_clicked = False
16
 
@@ -31,19 +27,14 @@ with st.sidebar:
31
  df, df_map = data.load_data()
32
  st.sidebar.success('데이터 로드 완료')
33
 
34
- st.title('Cell Off Recommendation System')
35
-
36
- # 사용자 입력
37
  date_input = st.date_input('날짜 선택:', st.session_state.date_input)
38
  time_input = st.time_input('시간 선택:', st.session_state.time_input)
39
  model_options = ['Rule-based', 'Kernel Model Based Reinforcement Learning']
40
  selected_model = st.selectbox('모델 선택:', model_options, index=model_options.index(st.session_state.selected_model) if st.session_state.selected_model else 0)
41
 
42
- # 주파수 선택
43
  frequency_options = ['2100MHz', '2600MHz - 10', '2600MHz - 20']
44
  frequency_input = st.selectbox('주파수 선택:', frequency_options, index=frequency_options.index(st.session_state.frequency_input))
45
 
46
- # 입력이 변경되면 상태 초기화
47
  if st.session_state.date_input != date_input:
48
  st.session_state.run_button_clicked = False
49
  st.session_state.date_input = date_input
@@ -60,11 +51,9 @@ if st.session_state.frequency_input != frequency_input:
60
  st.session_state.run_button_clicked = False
61
  st.session_state.frequency_input = frequency_input
62
 
63
- # Run 버튼
64
  run_button = st.button('Run')
65
 
66
  def load_and_predict(model_name, df_map, timestamp_input, frequencies, progress_callback=None):
67
- # 주파수 별 추천 셀 상태 초기화
68
  recommended_cell_states = {freq: {} for freq in frequencies}
69
 
70
  if progress_callback:
@@ -82,18 +71,15 @@ def load_and_predict(model_name, df_map, timestamp_input, frequencies, progress_
82
 
83
  return recommended_cell_states
84
 
85
- # 버튼이 클릭되면 세션 상태를 True로 설정
86
  if run_button:
87
  st.session_state.run_button_clicked = True
88
 
89
- # 세션 상태를 활용하여 run_button_clicked가 True일 때 실행
90
  if st.session_state.run_button_clicked:
91
 
92
  progress_bar = st.sidebar.progress(0)
93
 
94
- # 입력된 타임스탬프 처리
95
  timestamp_input = datetime.combine(date_input, time_input)
96
- frequencies_to_check = ['2100MHz', '2600MHz - 10', '2600MHz - 20'] # 특정 주파수 목록
97
  recommended_cell_states = load_and_predict(
98
  selected_model,
99
  df_map,
@@ -120,7 +106,6 @@ if st.session_state.run_button_clicked:
120
 
121
  st.markdown(f"##### **Cell**: {matching_enbid_pci}")
122
 
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)
 
5
  import map_recommend
6
  import data
7
 
8
+ st.title('Recommendation System')
 
 
 
9
 
 
10
  if 'run_button_clicked' not in st.session_state:
11
  st.session_state.run_button_clicked = False
12
 
 
27
  df, df_map = data.load_data()
28
  st.sidebar.success('데이터 로드 완료')
29
 
 
 
 
30
  date_input = st.date_input('날짜 선택:', st.session_state.date_input)
31
  time_input = st.time_input('시간 선택:', st.session_state.time_input)
32
  model_options = ['Rule-based', 'Kernel Model Based Reinforcement Learning']
33
  selected_model = st.selectbox('모델 선택:', model_options, index=model_options.index(st.session_state.selected_model) if st.session_state.selected_model else 0)
34
 
 
35
  frequency_options = ['2100MHz', '2600MHz - 10', '2600MHz - 20']
36
  frequency_input = st.selectbox('주파수 선택:', frequency_options, index=frequency_options.index(st.session_state.frequency_input))
37
 
 
38
  if st.session_state.date_input != date_input:
39
  st.session_state.run_button_clicked = False
40
  st.session_state.date_input = date_input
 
51
  st.session_state.run_button_clicked = False
52
  st.session_state.frequency_input = frequency_input
53
 
 
54
  run_button = st.button('Run')
55
 
56
  def load_and_predict(model_name, df_map, timestamp_input, frequencies, progress_callback=None):
 
57
  recommended_cell_states = {freq: {} for freq in frequencies}
58
 
59
  if progress_callback:
 
71
 
72
  return recommended_cell_states
73
 
 
74
  if run_button:
75
  st.session_state.run_button_clicked = True
76
 
 
77
  if st.session_state.run_button_clicked:
78
 
79
  progress_bar = st.sidebar.progress(0)
80
 
 
81
  timestamp_input = datetime.combine(date_input, time_input)
82
+ frequencies_to_check = ['2100MHz', '2600MHz - 10', '2600MHz - 20']
83
  recommended_cell_states = load_and_predict(
84
  selected_model,
85
  df_map,
 
106
 
107
  st.markdown(f"##### **Cell**: {matching_enbid_pci}")
108
 
 
109
  for freq in frequencies_to_check:
110
  status = recommended_cell_states[freq].get(matching_enbid_pci, 'Unknown')
111
  color = '#D32F2F' if status == '0' else '#1976D2' # 빨간색 (OFF) / 파란색 (ON)