Spaces:
Sleeping
Sleeping
Upload 9 files
Browse files- .gitattributes +1 -0
- app.py +68 -0
- bokeh_example.html +0 -0
- data_traffic_accidents.xlsx +3 -0
- folium_example.html +127 -0
- network.png +0 -0
- photo1.jpg +0 -0
- photo2.jpg +0 -0
- requirements.txt +9 -0
- wordcloud.png +0 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
data_traffic_accidents.xlsx filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import matplotlib.pyplot as plt
|
4 |
+
import pandas_bokeh
|
5 |
+
import folium
|
6 |
+
from streamlit_folium import st_folium
|
7 |
+
import requests
|
8 |
+
|
9 |
+
st.markdown("# 경희대 인근 가성비 좋은 맛집 늘어 ... 건강식은 '글쎄'")
|
10 |
+
st.markdown("#### '분식, 중식, 한식에 일식까지 다양한 음식 싸게 제공")
|
11 |
+
st.markdown("#### 축제 행사에 햄버거-핫도그 푸드트럭도 등장")
|
12 |
+
st.write('''경희대 인근에는 최근 가성비 좋은 맛집들이 속속 들어서며 학생들 사이에서 인기를 끌고 있다. 한정된 대학생 지갑사정에 맞는 저렴한 가격과 다양하고 퀄리티 높은 메뉴로 입소문이 나면서 성업 중인 것이다.
|
13 |
+
이처럼 경희대 주변에는 학생들 사이에서 입소문이 자자한 가성비 맛집들이 많다. 뿐만 아니라 대학 축제 때면 다양한 [푸드트럭](https://namu.wiki/w/%ED%91%B8%EB%93%9C%20%ED%8A%B8%EB%9F%AD)들도 찾아와 저렴하고 맛있는 메뉴를 선보이며 큰 인기를 끈다.
|
14 |
+
최근 물가상승으로 인해 외식비 부담이 큰 대학생들에게 이런 가성비 높은 맛집과 푸드트럭은 환영받을 만하다.''' )
|
15 |
+
|
16 |
+
st.write("<br><br><br>", unsafe_allow_html=True) # 3줄 띄어쓰기
|
17 |
+
|
18 |
+
st.markdown("#### 싼 게 비지떡? 건강식은 안 보이네")
|
19 |
+
st.markdown("#### 저렴하고 푸짐하지만 영양과 건강은 실종")
|
20 |
+
st.write('''경희대 인근 맛집들의 메뉴를 자세히 보면 건강한 식재료나 영양은 크게 고려되지 않은 것 같아 아쉬움이 남는다.
|
21 |
+
대학가에서 건강에 대한 고민보다 싸고 배부르게 먹을 수 있는 곳이 인기인 점은 이해된다. 하지만 한번쯤은 영양과 건강을 생각해봐야 한다.
|
22 |
+
청년때부터 건강식을 섭취하고 올바른 식습관을 가져야하기 때문이다.''' )
|
23 |
+
|
24 |
+
st.markdown("#### 대학가 먹거리, 건강의 균형을 잡아야 할 때")
|
25 |
+
st.write(''' 전문가 OOO에 따르면 ~~~~~''')
|
26 |
+
|
27 |
+
|
28 |
+
# 사진 삽입
|
29 |
+
st.image('photo1.jpg', caption='지난 4월20일 경희대 교내에서 학생들이 푸드트럭에서 음식을 구매하고 있다')
|
30 |
+
st.image('photo2.jpg', caption='경희대 근처 맛집 지도(--- 제공)')
|
31 |
+
|
32 |
+
# 데이터 불러오기
|
33 |
+
df = pd.read_excel('data_traffic_accidents.xlsx', index_col=0)
|
34 |
+
st.write('다음 데이터는 전국의 교통사고를 지역별로 집계한 것이다')
|
35 |
+
#st.write(df)
|
36 |
+
|
37 |
+
# 검색어 입력 받아 데이터 선택적으로 출력
|
38 |
+
query = st.text_input('이 곳에 지역명(시군구동읍면)을 입력하면 관련 데이터만 검색해 보여줍니다', key='region1_input')
|
39 |
+
df['select1']=df['사고지역위치명'].apply(lambda x: 1 if query in x else 0)
|
40 |
+
st.write('검색 결과:', df[df['select1']==1])
|
41 |
+
|
42 |
+
# 교통사고 유형과 연도에 따른 pivot table 보여주기
|
43 |
+
df_pivot=df.pivot_table(index='사고유형구분', columns='사고연도', values='사고건수', aggfunc='sum')
|
44 |
+
df_heatmap=df_pivot.style.background_gradient(cmap='Oranges').format("{:.2f}")
|
45 |
+
st.write('다음 표는 교통사고 건수를 유형과 연도에 따라 구분한 것이다', df_heatmap)
|
46 |
+
|
47 |
+
# 워드클라우드 보여주기
|
48 |
+
st.write('주요 단어들을 워드클라우드로 보여주면 다음과 같다')
|
49 |
+
st.image('wordcloud.png')
|
50 |
+
|
51 |
+
# 연결망그림 보여주기
|
52 |
+
st.write('''취재팀은 주요 단어들 간에 공동출현하는 관계를 바탕으로 의미연결망을 그려보았다.
|
53 |
+
분석결과, ~~설명~~''')
|
54 |
+
st.image('network.png')
|
55 |
+
|
56 |
+
# 그래프 html 보여주기
|
57 |
+
st.write('''취재팀은 교통사고 사고건수와 사망자수 간의 관계를 그래프로 표시했다 분석결과, ~~설명~~
|
58 |
+
그래프 각 점에 마우스를 놓으면 지역 정보가 나타난다''')
|
59 |
+
with open('bokeh_example.html', 'r', encoding='utf-8') as f:
|
60 |
+
html_content1 = f.read()
|
61 |
+
st.components.v1.html(html_content1, height=500) # markdown보다 복잡한 html 파일 작동에 강함
|
62 |
+
|
63 |
+
# 지도 html 보여주기
|
64 |
+
st.write('''취재팀은 서울시 주요 대학의 위치와 정보를 지도에 표기해 보았다. 분석결과, ~~설명~~
|
65 |
+
지도 위 표기 지점에 마우스를 놓으면 관련 정보가 나타난다''')
|
66 |
+
with open('folium_example.html', 'r', encoding='utf-8') as f:
|
67 |
+
html_content2 = f.read()
|
68 |
+
st.components.v1.html(html_content2, height=500)
|
bokeh_example.html
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data_traffic_accidents.xlsx
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6cbe09c6afa2d36d525aaf0e9efd7a726c296f8b59ab50b2703979e52d478469
|
3 |
+
size 5148724
|
folium_example.html
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html>
|
3 |
+
<head>
|
4 |
+
|
5 |
+
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
6 |
+
|
7 |
+
<script>
|
8 |
+
L_NO_TOUCH = false;
|
9 |
+
L_DISABLE_3D = false;
|
10 |
+
</script>
|
11 |
+
|
12 |
+
<style>html, body {width: 100%;height: 100%;margin: 0;padding: 0;}</style>
|
13 |
+
<style>#map {position:absolute;top:0;bottom:0;right:0;left:0;}</style>
|
14 |
+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.js"></script>
|
15 |
+
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
|
16 |
+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
|
17 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js"></script>
|
18 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.css"/>
|
19 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"/>
|
20 |
+
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css"/>
|
21 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css"/>
|
22 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css"/>
|
23 |
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css"/>
|
24 |
+
|
25 |
+
<meta name="viewport" content="width=device-width,
|
26 |
+
initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
|
27 |
+
<style>
|
28 |
+
#map_ed45e426e4e625d1487296ea56b9516c {
|
29 |
+
position: relative;
|
30 |
+
width: 100.0%;
|
31 |
+
height: 100.0%;
|
32 |
+
left: 0.0%;
|
33 |
+
top: 0.0%;
|
34 |
+
}
|
35 |
+
.leaflet-container { font-size: 1rem; }
|
36 |
+
</style>
|
37 |
+
|
38 |
+
</head>
|
39 |
+
<body>
|
40 |
+
|
41 |
+
|
42 |
+
<div class="folium-map" id="map_ed45e426e4e625d1487296ea56b9516c" ></div>
|
43 |
+
|
44 |
+
</body>
|
45 |
+
<script>
|
46 |
+
|
47 |
+
|
48 |
+
var map_ed45e426e4e625d1487296ea56b9516c = L.map(
|
49 |
+
"map_ed45e426e4e625d1487296ea56b9516c",
|
50 |
+
{
|
51 |
+
center: [37.567, 126.978],
|
52 |
+
crs: L.CRS.EPSG3857,
|
53 |
+
zoom: 12,
|
54 |
+
zoomControl: true,
|
55 |
+
preferCanvas: false,
|
56 |
+
}
|
57 |
+
);
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
var tile_layer_41a0f1aae01a4ef313b7f6ff18d8d25a = L.tileLayer(
|
64 |
+
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
65 |
+
{"attribution": "Data by \u0026copy; \u003ca target=\"_blank\" href=\"http://openstreetmap.org\"\u003eOpenStreetMap\u003c/a\u003e, under \u003ca target=\"_blank\" href=\"http://www.openstreetmap.org/copyright\"\u003eODbL\u003c/a\u003e.", "detectRetina": false, "maxNativeZoom": 18, "maxZoom": 18, "minZoom": 0, "noWrap": false, "opacity": 1, "subdomains": "abc", "tms": false}
|
66 |
+
).addTo(map_ed45e426e4e625d1487296ea56b9516c);
|
67 |
+
|
68 |
+
|
69 |
+
var marker_40a0d3b3071e46ce44c855dd28b7197e = L.marker(
|
70 |
+
[37.592, 127.052],
|
71 |
+
{}
|
72 |
+
).addTo(map_ed45e426e4e625d1487296ea56b9516c);
|
73 |
+
|
74 |
+
|
75 |
+
var popup_c08cc328a5125b3fad894b79123b4297 = L.popup({"maxWidth": 500});
|
76 |
+
|
77 |
+
|
78 |
+
|
79 |
+
var html_b3968776944b9326f1cbe8befde69049 = $(`<div id="html_b3968776944b9326f1cbe8befde69049" style="width: 100.0%; height: 100.0%;">경희대</div>`)[0];
|
80 |
+
popup_c08cc328a5125b3fad894b79123b4297.setContent(html_b3968776944b9326f1cbe8befde69049);
|
81 |
+
|
82 |
+
|
83 |
+
|
84 |
+
marker_40a0d3b3071e46ce44c855dd28b7197e.bindPopup(popup_c08cc328a5125b3fad894b79123b4297)
|
85 |
+
;
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
marker_40a0d3b3071e46ce44c855dd28b7197e.bindTooltip(
|
91 |
+
`<div>
|
92 |
+
클릭
|
93 |
+
</div>`,
|
94 |
+
{"sticky": true}
|
95 |
+
);
|
96 |
+
|
97 |
+
|
98 |
+
var marker_d35363d0a8fe53316869ae36187a1457 = L.marker(
|
99 |
+
[37.56, 126.937],
|
100 |
+
{}
|
101 |
+
).addTo(map_ed45e426e4e625d1487296ea56b9516c);
|
102 |
+
|
103 |
+
|
104 |
+
var popup_d92fbb3aa56507683aedb49a771e3e7a = L.popup({"maxWidth": 500});
|
105 |
+
|
106 |
+
|
107 |
+
|
108 |
+
var html_81e8244e5d4ab9b0ada91f9b0c8ffa5e = $(`<div id="html_81e8244e5d4ab9b0ada91f9b0c8ffa5e" style="width: 100.0%; height: 100.0%;">연세대</div>`)[0];
|
109 |
+
popup_d92fbb3aa56507683aedb49a771e3e7a.setContent(html_81e8244e5d4ab9b0ada91f9b0c8ffa5e);
|
110 |
+
|
111 |
+
|
112 |
+
|
113 |
+
marker_d35363d0a8fe53316869ae36187a1457.bindPopup(popup_d92fbb3aa56507683aedb49a771e3e7a)
|
114 |
+
;
|
115 |
+
|
116 |
+
|
117 |
+
|
118 |
+
|
119 |
+
marker_d35363d0a8fe53316869ae36187a1457.bindTooltip(
|
120 |
+
`<div>
|
121 |
+
클릭
|
122 |
+
</div>`,
|
123 |
+
{"sticky": true}
|
124 |
+
);
|
125 |
+
|
126 |
+
</script>
|
127 |
+
</html>
|
network.png
ADDED
![]() |
photo1.jpg
ADDED
![]() |
photo2.jpg
ADDED
![]() |
requirements.txt
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
pandas
|
3 |
+
openpyxl
|
4 |
+
matplotlib
|
5 |
+
pandas-bokeh
|
6 |
+
bokeh==2.4.3
|
7 |
+
folium
|
8 |
+
streamlit-folium
|
9 |
+
requests
|
wordcloud.png
ADDED
![]() |