SUNGJIN LEE
commited on
Commit
·
2ac1269
1
Parent(s):
312b9eb
Huggingface 최적화
Browse files- .devcontainer/devcontainer.json +0 -33
- data.py +8 -35
- pages/Dashboard.py +5 -2
- pages/Recommendation System.py +4 -5
- requirements.txt +1 -11
.devcontainer/devcontainer.json
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "Python 3",
|
3 |
-
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
4 |
-
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
|
5 |
-
"customizations": {
|
6 |
-
"codespaces": {
|
7 |
-
"openFiles": [
|
8 |
-
"README.md",
|
9 |
-
"Home.py"
|
10 |
-
]
|
11 |
-
},
|
12 |
-
"vscode": {
|
13 |
-
"settings": {},
|
14 |
-
"extensions": [
|
15 |
-
"ms-python.python",
|
16 |
-
"ms-python.vscode-pylance"
|
17 |
-
]
|
18 |
-
}
|
19 |
-
},
|
20 |
-
"updateContentCommand": "[ -f packages.txt ] && sudo apt update && sudo apt upgrade -y && sudo xargs apt install -y <packages.txt; [ -f requirements.txt ] && pip3 install --user -r requirements.txt; pip3 install --user streamlit; echo '✅ Packages installed and Requirements met'",
|
21 |
-
"postAttachCommand": {
|
22 |
-
"server": "streamlit run Home.py --server.enableCORS false --server.enableXsrfProtection false"
|
23 |
-
},
|
24 |
-
"portsAttributes": {
|
25 |
-
"8501": {
|
26 |
-
"label": "Application",
|
27 |
-
"onAutoForward": "openPreview"
|
28 |
-
}
|
29 |
-
},
|
30 |
-
"forwardPorts": [
|
31 |
-
8501
|
32 |
-
]
|
33 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data.py
CHANGED
@@ -1,48 +1,21 @@
|
|
1 |
-
|
2 |
import streamlit as st
|
3 |
-
|
4 |
-
from googleapiclient.discovery import build
|
5 |
-
from googleapiclient.http import MediaIoBaseDownload
|
6 |
-
import io
|
7 |
-
|
8 |
-
# Google Drive 및 Sheets API 인증
|
9 |
-
scope = [
|
10 |
-
"https://www.googleapis.com/auth/drive.readonly"
|
11 |
-
]
|
12 |
-
credentials = Credentials.from_service_account_info(st.secrets["google"], scopes=scope)
|
13 |
-
file_id = st.secrets["drive"]["file_id"]
|
14 |
|
15 |
-
|
|
|
|
|
|
|
16 |
|
17 |
@st.cache_data(show_spinner=False)
|
18 |
def load_data():
|
19 |
-
request = drive_service.files().get_media(fileId=file_id)
|
20 |
-
|
21 |
-
file_buffer = io.BytesIO()
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
progress_bar = st.sidebar.progress(0)
|
27 |
-
progress_text = st.sidebar.empty()
|
28 |
-
progress_text.text("데이터 불러오는 중...")
|
29 |
-
|
30 |
-
while not done:
|
31 |
-
status, done = downloader.next_chunk()
|
32 |
-
progress = int(status.progress() * 100)
|
33 |
-
progress_bar.progress(progress)
|
34 |
-
progress_text.text(f"데이터 불러오는 중...({progress}%)")
|
35 |
-
|
36 |
-
file_buffer.seek(0)
|
37 |
-
df = pd.read_csv(file_buffer)
|
38 |
|
39 |
df['ru_svc_lat_val'] = df['ru_svc_lat_val'].astype(float)
|
40 |
df['ru_svc_lng_val'] = df['ru_svc_lng_val'].astype(float)
|
41 |
|
42 |
df_map = df.drop_duplicates(subset=['ru_svc_lat_val', 'ru_svc_lng_val'])
|
43 |
|
44 |
-
progress_bar.empty()
|
45 |
-
progress_text.empty()
|
46 |
-
st.sidebar.success("데이터 로드 완료!")
|
47 |
-
|
48 |
return df, df_map
|
|
|
1 |
+
from datasets import load_dataset
|
2 |
import streamlit as st
|
3 |
+
import pandas as pd
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
+
data_files = {
|
6 |
+
"train": "ELG_Busan_PoC_per_CA_site_0226_0407.csv",
|
7 |
+
"test": "ELG_Busan_PoC_per_CA_site_0408_0519.csv"
|
8 |
+
}
|
9 |
|
10 |
@st.cache_data(show_spinner=False)
|
11 |
def load_data():
|
|
|
|
|
|
|
12 |
|
13 |
+
dataset = load_dataset('skt-asap/busan-poc-dataset', data_files=data_files)
|
14 |
+
df = dataset['train'].to_pandas()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
df['ru_svc_lat_val'] = df['ru_svc_lat_val'].astype(float)
|
17 |
df['ru_svc_lng_val'] = df['ru_svc_lng_val'].astype(float)
|
18 |
|
19 |
df_map = df.drop_duplicates(subset=['ru_svc_lat_val', 'ru_svc_lng_val'])
|
20 |
|
|
|
|
|
|
|
|
|
21 |
return df, df_map
|
pages/Dashboard.py
CHANGED
@@ -15,7 +15,10 @@ if not st.session_state.get('authentication_status', False):
|
|
15 |
st.write("이 페이지를 볼 수 있는 권한이 없습니다.<br>로그인해 주세요.", unsafe_allow_html=True)
|
16 |
st.stop()
|
17 |
|
18 |
-
|
|
|
|
|
|
|
19 |
|
20 |
cell_map = map.create_map(df_map)
|
21 |
|
@@ -31,7 +34,7 @@ def main():
|
|
31 |
show_map = st.sidebar.checkbox("지도 보기", True)
|
32 |
if show_map:
|
33 |
st.markdown("### 🗺️ 부산 PoC 셀 사이트")
|
34 |
-
|
35 |
folium_static(cell_map)
|
36 |
|
37 |
st.write("""
|
|
|
15 |
st.write("이 페이지를 볼 수 있는 권한이 없습니다.<br>로그인해 주세요.", unsafe_allow_html=True)
|
16 |
st.stop()
|
17 |
|
18 |
+
with st.sidebar:
|
19 |
+
with st.spinner("데이터 로딩 중..."):
|
20 |
+
df, df_map = data.load_data()
|
21 |
+
st.sidebar.success('데이터 로드 완료')
|
22 |
|
23 |
cell_map = map.create_map(df_map)
|
24 |
|
|
|
34 |
show_map = st.sidebar.checkbox("지도 보기", True)
|
35 |
if show_map:
|
36 |
st.markdown("### 🗺️ 부산 PoC 셀 사이트")
|
37 |
+
|
38 |
folium_static(cell_map)
|
39 |
|
40 |
st.write("""
|
pages/Recommendation System.py
CHANGED
@@ -52,11 +52,10 @@ def load_and_predict(model_name, input_data, df_map, progress_callback=None):
|
|
52 |
|
53 |
if run_button:
|
54 |
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
df, df_map = data.load_data()
|
60 |
|
61 |
progress_bar = st.sidebar.progress(0)
|
62 |
|
|
|
52 |
|
53 |
if run_button:
|
54 |
|
55 |
+
with st.sidebar:
|
56 |
+
with st.spinner('데이터 로딩 중...'):
|
57 |
+
df, df_map = data.load_data()
|
58 |
+
st.sidebar.success('데이터 로드 완료')
|
|
|
59 |
|
60 |
progress_bar = st.sidebar.progress(0)
|
61 |
|
requirements.txt
CHANGED
@@ -4,17 +4,7 @@ Flask-Cors==4.0.1
|
|
4 |
Flask-SocketIO==5.3.6
|
5 |
flatbuffers==24.3.25
|
6 |
folium==0.17.0
|
7 |
-
|
8 |
-
google-api-python-client==2.139.0
|
9 |
-
google-auth==2.32.0
|
10 |
-
google-auth-httplib2==0.2.0
|
11 |
-
google-auth-oauthlib==1.2.1
|
12 |
-
google-pasta==0.2.0
|
13 |
-
googleapis-common-protos==1.63.2
|
14 |
-
gspread==5.12.4
|
15 |
-
gspread-dataframe==4.0.0
|
16 |
-
gspread-formatting==1.2.0
|
17 |
-
gspread-pandas==3.3.0
|
18 |
keras==3.4.1
|
19 |
matplotlib==3.9.1
|
20 |
matplotlib-inline==0.1.7
|
|
|
4 |
Flask-SocketIO==5.3.6
|
5 |
flatbuffers==24.3.25
|
6 |
folium==0.17.0
|
7 |
+
datasets==2.20.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
keras==3.4.1
|
9 |
matplotlib==3.9.1
|
10 |
matplotlib-inline==0.1.7
|