SoDehghan commited on
Commit
772f16a
1 Parent(s): dff6f8d

Update models/hsd_tr.py

Browse files
Files changed (1) hide show
  1. models/hsd_tr.py +24 -0
models/hsd_tr.py CHANGED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ import streamlit as st
9
+ from transformers import pipeline
10
+
11
+ sentiment_pipeline = pipeline(task = "text-classification", model = "gritli/bert-sentiment-analyses-imdb")
12
+
13
+ st.title("Hate Speech Detection in Turkish with HuggingFace Spaces")
14
+ st.write("Enter a sentence to detect its hateful:")
15
+
16
+ label_dict = {'LABEL_0': 'Hate', 'LABEL_1': 'Non-hate'}
17
+
18
+ user_input = st.text_input("")
19
+ if user_input:
20
+ result = sentiment_pipeline(user_input)
21
+ sentiment = result[0]["label"]
22
+
23
+ sentiment = label_dict[sentiment]
24
+ st.write(f"Detection: {sentiment}")