SoDehghan commited on
Commit
75f5091
·
verified ·
1 Parent(s): 041f6f6

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -53
app.py DELETED
@@ -1,53 +0,0 @@
1
- import awesome_streamlit as ast
2
- import streamlit as st
3
- import requests
4
- import time
5
- from transformers import pipeline
6
- import os
7
-
8
-
9
- # Set the page configuration
10
- st.set_page_config(
11
- page_title="Hate Speech Detection",
12
- page_icon="📖", #":bar_chart:"
13
- layout='centered'
14
- )
15
-
16
- #title = r"$\textsf{\small Hate Speech Detection}$"
17
- #st.title(title)
18
- #st.write("In this HuggingFace space you will be able to use our Hate Speech Detection model built at [VERİM - Center of Excellence in Data Analytics - Sabanci University](https://github.com/verimsu).")
19
-
20
-
21
- # Turkish
22
- sentiment_pipeline_tr = pipeline(task = "text-classification", model = "SoDehghan/BERTurk-hate-speech") # "gritli/bert-sentiment-analyses-imdb"
23
- header_tr = r"$\textsf{\scriptsize HSD in Turkish}$"
24
- st.subheader(header_tr)
25
-
26
- tr_input = st.text_area("Enter your text here:", height=50, key="tr_input") #height=30
27
- if st.button("Click for predictions!", key="tr_predict"):
28
- with st.spinner('Generating predictions...'):
29
- result_tr = sentiment_pipeline_tr(tr_input)
30
- sentiment_tr = result_tr[0]["label"]
31
- label_dict = {'LABEL_1': 'Hate ❌', 'LABEL_0': 'Non-hate ✅'} #🚫
32
- sentiment_tr = label_dict[sentiment_tr]
33
- st.write(f"Detection: {sentiment_tr}")
34
-
35
-
36
- # Arabic
37
- sentiment_pipeline_ar = pipeline(task = "text-classification", model = "SoDehghan/BERTurk-hate-speech")
38
- header_ar = r"$\textsf{\scriptsize HSD in Arabic}$"
39
- st.subheader(header_ar)
40
-
41
- ar_input = st.text_area("Enter your text here:", height=50 , key="ar_input")
42
- if st.button("Click for predictions!", key="ar_predict"):
43
- with st.spinner('Generating predictions...'):
44
- result_ar = sentiment_pipeline_ar(ar_input)
45
- sentiment_ar = result_ar[0]["label"]
46
- label_dict = {'LABEL_1': 'Hate ❌', 'LABEL_0': 'Non-hate ✅'}
47
- sentiment_ar = label_dict[sentiment_ar]
48
- st.write(f"Detection: {sentiment_ar}")
49
-
50
-
51
- st.sidebar.title("Hate Speech Detection")
52
- #st.sidebar.write("In this HuggingFace space you can use Hate Speech Detection model built at [VERİM - Center of Excellence in Data Analytics - Sabanci University](https://github.com/verimsu).")
53
- st.sidebar.write("This tool is developed in the context of the EU project "Utilizing Digital Technology for Social Cohesion, Positive Messaging and Peace by Boosting Collaboration, Exchange and Solidarity" (EuropeAid/170389/DD/ACT/Multi) by [Sabanci University Center of Excellence in Data Analytics](https://github.com/verimsu).")