File size: 2,691 Bytes
dc2d416
 
733e042
 
dc2d416
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
733e042
 
 
dc2d416
 
51129a6
dc2d416
 
733e042
dc2d416
 
 
 
 
 
733e042
dc2d416
51129a6
11cf8c1
 
51129a6
 
 
11cf8c1
9cca96e
 
11cf8c1
 
 
 
 
 
 
 
9cca96e
11cf8c1
 
 
 
 
 
 
 
 
 
520d644
11cf8c1
 
 
733e042
dc2d416
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import streamlit as st
import leafmap.foliumap as leafmap
import whitebox


st.set_page_config(layout="wide")

st.sidebar.info(
    """
    - Web App URL: <https://interactive-crime-map.hf.space/>
    - HuggingFace repository: <https://huggingface.co/spaces/interactive-crime/map/tree/main>
    """
)

st.sidebar.title("Contact")
st.sidebar.info(
    """
    Yunus Serhat Bıçakçı at [yunusserhat.com](https://yunusserhat.com) | [GitHub](https://github.com/yunusserhat) | [Twitter](https://twitter.com/yunusserhat) | [LinkedIn](https://www.linkedin.com/in/yunusserhat)
    """
)

st.title("Hate Speech Interactive Map Application")

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>'


st.markdown(
    """
    The interactive map illustrate a hate crime tweets in London boroughs for the month of December 2022. Model 1 is the latest model from [TweetNLP](https://arxiv.org/pdf/2206.14774.pdf) and [CardiffNLP](https://huggingface.co/cardiffnlp/twitter-roberta-base-hate-multiclass-latest), and Model 2 is an older version of Model 1, owned by [Dimosthenis Antypas](https://huggingface.co/antypasd/). Both models have been utilized for hate speech detection.
    """
)
st.markdown(please_note, unsafe_allow_html=True)
st.markdown(
    """

    """
)

# add whitebox tools to the map
m = leafmap.Map(center=[51.50, -0.1], zoom=10)
tweets2 = 'https://raw.githubusercontent.com/yunusserhat/data/main/data/London2022DecHateTweetsLatLong.csv'
borough2 = 'https://raw.githubusercontent.com/yunusserhat/data/main/data/londonborough.geojson'

tweets = 'https://raw.githubusercontent.com/yunusserhat/data/main/data/multiclass_latest_latlng.csv'
borough = 'https://raw.githubusercontent.com/yunusserhat/data/main/data/londonborough.geojson'

map_option = st.selectbox('Choose a Map', ('Model 1', 'Model 2'))
#palette_model_1 = ["red", "blue", "green", "yellow", "purple", "orange"]
#palette_model_2 = ["red", "blue", "green", "yellow", "purple"]

if map_option == 'Model 1':
    m.add_geojson(borough, layer_name='London Boroughs')
    m.add_points_from_xy(
        tweets,
        x="Longitude",
        y="Latitude",
        color_column='Hate Prediction',
        palette="RedYellowBlue_11",
        spin=True,
        add_legend=True
    )
else:
    m.add_geojson(borough2, layer_name='London Boroughs 2')
    m.add_points_from_xy(
        tweets2,
        x="Longitude",
        y="Latitude",
        color_column='Hate Prediction',
        palette="GreenMagenta_16",
        spin=True,
        add_legend=True
    )

m.to_streamlit()