Spaces:
Sleeping
Sleeping
Yunus Serhat Bıçakçı
commited on
Commit
·
dc2d416
1
Parent(s):
c5017d8
update
Browse files- Application.py +20 -26
- pages/2_↔️_Comparision.py +2 -2
- pages/{4_Choropleth.py → 3_😡_Hate_Tweets.py} +33 -13
Application.py
CHANGED
|
@@ -21,36 +21,30 @@ st.sidebar.info(
|
|
| 21 |
|
| 22 |
st.title("Interactive Crime Map Application")
|
| 23 |
|
| 24 |
-
st.
|
| 25 |
"""
|
| 26 |
-
This interactive crime map apps created using [streamlit](https://streamlit.io) and open-source mapping libraries,
|
| 27 |
-
such as [leafmap](https://leafmap.org), [geemap](https://geemap.org), [pydeck](https://deckgl.readthedocs.io), and [kepler.gl](https://docs.kepler.gl/docs/keplergl-jupyter).
|
| 28 |
-
|
| 29 |
"""
|
| 30 |
)
|
| 31 |
|
| 32 |
st.info("Click on the left sidebar menu to navigate to the different apps.")
|
| 33 |
|
| 34 |
-
st.subheader("Interactive Crime Map Application")
|
| 35 |
-
st.markdown(
|
| 36 |
-
"""
|
| 37 |
-
|
| 38 |
-
"""
|
| 39 |
-
)
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
st.title("Interactive Crime Map Application")
|
| 23 |
|
| 24 |
+
st.subheader(
|
| 25 |
"""
|
| 26 |
+
This interactive crime map apps created using [streamlit](https://streamlit.io) and open-source mapping libraries, such as [leafmap](https://leafmap.org), [geopandas](https://geopandas.org), and [folium](https://python-visualization.github.io/folium/).
|
|
|
|
|
|
|
| 27 |
"""
|
| 28 |
)
|
| 29 |
|
| 30 |
st.info("Click on the left sidebar menu to navigate to the different apps.")
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
row1_col1, row1_col2 = st.columns(2)
|
| 36 |
+
with row1_col1:
|
| 37 |
+
st.markdown('''
|
| 38 |
+
<a href="https://interactive-crime-map.hf.space/Comparision">
|
| 39 |
+
<img src="https://raw.githubusercontent.com/yunusserhat/github/main/data/comparision.png" style="width: 100%; height: 100%" />
|
| 40 |
+
</a>''',
|
| 41 |
+
unsafe_allow_html=True
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
with row1_col2:
|
| 45 |
+
st.markdown('''
|
| 46 |
+
<a href="https://interactive-crime-map.hf.space/Hate_Tweets">
|
| 47 |
+
<img src="https://raw.githubusercontent.com/yunusserhat/github/main/data/hatespeech.png" style="width: 100%; height: 100%" />
|
| 48 |
+
</a>''',
|
| 49 |
+
unsafe_allow_html=True
|
| 50 |
+
)
|
pages/2_↔️_Comparision.py
CHANGED
|
@@ -72,7 +72,7 @@ with row2_col2:
|
|
| 72 |
row3_col1, row3_col2 = st.columns([1, 1])
|
| 73 |
|
| 74 |
with row3_col1:
|
| 75 |
-
m.to_streamlit(
|
| 76 |
|
| 77 |
with row3_col2:
|
| 78 |
-
m2.to_streamlit(
|
|
|
|
| 72 |
row3_col1, row3_col2 = st.columns([1, 1])
|
| 73 |
|
| 74 |
with row3_col1:
|
| 75 |
+
m.to_streamlit()
|
| 76 |
|
| 77 |
with row3_col2:
|
| 78 |
+
m2.to_streamlit()
|
pages/{4_Choropleth.py → 3_😡_Hate_Tweets.py}
RENAMED
|
@@ -1,5 +1,8 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import leafmap.foliumap as leafmap
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
st.set_page_config(layout="wide")
|
| 5 |
|
|
@@ -17,19 +20,36 @@ st.sidebar.info(
|
|
| 17 |
"""
|
| 18 |
)
|
| 19 |
|
| 20 |
-
st.title("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
data = "https://raw.githubusercontent.com/yunusserhat/Github/main/data/boroughs_count_df_2022_dec.geojson"
|
| 25 |
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
column = "count",
|
| 30 |
-
scheme='Quantiles',
|
| 31 |
-
cmap='Blues',
|
| 32 |
-
legend_title='Hate Tweets'
|
| 33 |
-
)
|
| 34 |
|
| 35 |
-
m.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import leafmap.foliumap as leafmap
|
| 3 |
+
import webbrowser
|
| 4 |
+
|
| 5 |
+
webbrowser.open("http://streamlit.io") # opens the URL in a new tab
|
| 6 |
|
| 7 |
st.set_page_config(layout="wide")
|
| 8 |
|
|
|
|
| 20 |
"""
|
| 21 |
)
|
| 22 |
|
| 23 |
+
st.title("Hate Speech Interactive Map Application")
|
| 24 |
+
|
| 25 |
+
st.markdown(
|
| 26 |
+
"""
|
| 27 |
+
The interactive map illustrate a hate crime tweets in London boroughs for the month of December 2022. [TweetNLP](https://arxiv.org/pdf/2206.14774.pdf) and [antypasd](https://huggingface.co/antypasd/twitter-roberta-base-hate-multiclass-latest)
|
| 28 |
+
models have been utilized for hate speech detection.
|
| 29 |
+
|
| 30 |
+
Please note that the information displayed may contain sentences containing hateful content. Kindly keep this in mind before reviewing the details.
|
| 31 |
+
"""
|
| 32 |
+
)
|
| 33 |
+
|
| 34 |
+
st.markdown(
|
| 35 |
+
"""
|
| 36 |
|
| 37 |
+
"""
|
| 38 |
+
)
|
|
|
|
| 39 |
|
| 40 |
+
m = leafmap.Map(center=[51.50, -0.1], zoom=10)
|
| 41 |
+
tweets = 'https://raw.githubusercontent.com/yunusserhat/Github/main/data/London2022DecHateTweetsLatLong.csv'
|
| 42 |
+
borough = 'https://raw.githubusercontent.com/yunusserhat/Github/main/data/londonborough.geojson'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
+
m.add_geojson(borough, layer_name='London Boroughs')
|
| 45 |
+
m.add_points_from_xy(
|
| 46 |
+
tweets,
|
| 47 |
+
x="Longitude",
|
| 48 |
+
y="Latitude"
|
| 49 |
+
# ,
|
| 50 |
+
# color_column='hate_pred',
|
| 51 |
+
# icon_names=['gear', 'map', 'leaf', 'globe'],
|
| 52 |
+
# spin=True,
|
| 53 |
+
# add_legend=True,
|
| 54 |
+
)
|
| 55 |
+
m.to_streamlit()
|