Spaces:
Sleeping
Sleeping
Yunus Serhat Bıçakçı
commited on
Commit
·
733e042
1
Parent(s):
4985b0c
update
Browse files- Application.py +1 -20
- pages/2_↔️_Comparision.py +2 -2
- pages/3_😡_Hate_Tweets.py +12 -6
Application.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import leafmap.foliumap as leafmap
|
| 3 |
|
| 4 |
-
|
| 5 |
st.set_page_config(layout="wide")
|
| 6 |
|
| 7 |
st.sidebar.info(
|
|
@@ -28,22 +27,4 @@ st.subheader(
|
|
| 28 |
|
| 29 |
st.info("Click on the left sidebar menu to navigate to the different apps.")
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
row1_col1, row1_col2 = st.columns(2)
|
| 35 |
-
with row1_col1:
|
| 36 |
-
st.markdown('''
|
| 37 |
-
<a href="https://interactive-crime-map.hf.space/Comparision">
|
| 38 |
-
<img src="https://raw.githubusercontent.com/yunusserhat/github/main/data/comparision.png" style="width: 100%; height: 100%" />
|
| 39 |
-
</a>''',
|
| 40 |
-
unsafe_allow_html=True
|
| 41 |
-
)
|
| 42 |
-
|
| 43 |
-
with row1_col2:
|
| 44 |
-
st.markdown('''
|
| 45 |
-
<a href="https://interactive-crime-map.hf.space/Hate_Tweets">
|
| 46 |
-
<img src="https://raw.githubusercontent.com/yunusserhat/github/main/data/hatespeech.png" style="width: 100%; height: 100%" />
|
| 47 |
-
</a>''',
|
| 48 |
-
unsafe_allow_html=True
|
| 49 |
-
)
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import leafmap.foliumap as leafmap
|
| 3 |
|
|
|
|
| 4 |
st.set_page_config(layout="wide")
|
| 5 |
|
| 6 |
st.sidebar.info(
|
|
|
|
| 27 |
|
| 28 |
st.info("Click on the left sidebar menu to navigate to the different apps.")
|
| 29 |
|
| 30 |
+
st.image('https://raw.githubusercontent.com/yunusserhat/Github/main/data/interactive-crime-demo.gif')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/2_↔️_Comparision.py
CHANGED
|
@@ -40,7 +40,7 @@ with row1_col1:
|
|
| 40 |
twitter,
|
| 41 |
column="count",
|
| 42 |
scheme='Quantiles',
|
| 43 |
-
cmap='
|
| 44 |
legend_title='Total Hate Tweet Number'
|
| 45 |
)
|
| 46 |
|
|
@@ -54,7 +54,7 @@ with row1_col2:
|
|
| 54 |
mps,
|
| 55 |
column="Crime_Number",
|
| 56 |
scheme='Quantiles',
|
| 57 |
-
cmap='
|
| 58 |
legend_title='Total Crime Number'
|
| 59 |
)
|
| 60 |
|
|
|
|
| 40 |
twitter,
|
| 41 |
column="count",
|
| 42 |
scheme='Quantiles',
|
| 43 |
+
cmap='YlOrRd',
|
| 44 |
legend_title='Total Hate Tweet Number'
|
| 45 |
)
|
| 46 |
|
|
|
|
| 54 |
mps,
|
| 55 |
column="Crime_Number",
|
| 56 |
scheme='Quantiles',
|
| 57 |
+
cmap='YlOrRd',
|
| 58 |
legend_title='Total Crime Number'
|
| 59 |
)
|
| 60 |
|
pages/3_😡_Hate_Tweets.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import leafmap.foliumap as leafmap
|
|
|
|
|
|
|
| 3 |
|
| 4 |
st.set_page_config(layout="wide")
|
| 5 |
|
|
@@ -19,21 +21,24 @@ st.sidebar.info(
|
|
| 19 |
|
| 20 |
st.title("Hate Speech Interactive Map Application")
|
| 21 |
|
|
|
|
|
|
|
|
|
|
| 22 |
st.markdown(
|
| 23 |
"""
|
| 24 |
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)
|
| 25 |
models have been utilized for hate speech detection.
|
| 26 |
|
| 27 |
-
Please note that the information displayed may contain sentences containing hateful content. Kindly keep this in mind before reviewing the details.
|
| 28 |
"""
|
| 29 |
)
|
| 30 |
-
|
| 31 |
st.markdown(
|
| 32 |
"""
|
| 33 |
|
| 34 |
"""
|
| 35 |
)
|
| 36 |
|
|
|
|
| 37 |
m = leafmap.Map(center=[51.50, -0.1], zoom=10)
|
| 38 |
tweets = 'https://raw.githubusercontent.com/yunusserhat/Github/main/data/London2022DecHateTweetsLatLong.csv'
|
| 39 |
borough = 'https://raw.githubusercontent.com/yunusserhat/Github/main/data/londonborough.geojson'
|
|
@@ -42,11 +47,12 @@ m.add_geojson(borough, layer_name='London Boroughs')
|
|
| 42 |
m.add_points_from_xy(
|
| 43 |
tweets,
|
| 44 |
x="Longitude",
|
| 45 |
-
y="Latitude"
|
| 46 |
# ,
|
| 47 |
-
|
| 48 |
# icon_names=['gear', 'map', 'leaf', 'globe'],
|
| 49 |
-
|
| 50 |
-
|
| 51 |
)
|
|
|
|
| 52 |
m.to_streamlit()
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import leafmap.foliumap as leafmap
|
| 3 |
+
import whitebox
|
| 4 |
+
|
| 5 |
|
| 6 |
st.set_page_config(layout="wide")
|
| 7 |
|
|
|
|
| 21 |
|
| 22 |
st.title("Hate Speech Interactive Map Application")
|
| 23 |
|
| 24 |
+
please_note = '<p style="color:Red; font-weight:bold;">Please note that the information displayed may contain sentences containing hateful content. Kindly keep this in mind before reviewing the details.</p>'
|
| 25 |
+
|
| 26 |
+
|
| 27 |
st.markdown(
|
| 28 |
"""
|
| 29 |
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)
|
| 30 |
models have been utilized for hate speech detection.
|
| 31 |
|
|
|
|
| 32 |
"""
|
| 33 |
)
|
| 34 |
+
st.markdown(please_note, unsafe_allow_html=True)
|
| 35 |
st.markdown(
|
| 36 |
"""
|
| 37 |
|
| 38 |
"""
|
| 39 |
)
|
| 40 |
|
| 41 |
+
# add whitebox tools to the map
|
| 42 |
m = leafmap.Map(center=[51.50, -0.1], zoom=10)
|
| 43 |
tweets = 'https://raw.githubusercontent.com/yunusserhat/Github/main/data/London2022DecHateTweetsLatLong.csv'
|
| 44 |
borough = 'https://raw.githubusercontent.com/yunusserhat/Github/main/data/londonborough.geojson'
|
|
|
|
| 47 |
m.add_points_from_xy(
|
| 48 |
tweets,
|
| 49 |
x="Longitude",
|
| 50 |
+
y="Latitude",
|
| 51 |
# ,
|
| 52 |
+
color_column='Hate Prediction',
|
| 53 |
# icon_names=['gear', 'map', 'leaf', 'globe'],
|
| 54 |
+
spin=True,
|
| 55 |
+
add_legend=True
|
| 56 |
)
|
| 57 |
+
|
| 58 |
m.to_streamlit()
|