SoDehghan commited on
Commit
75871a8
·
verified ·
1 Parent(s): 043a1f2

Update models/hsd_tr.py

Browse files
Files changed (1) hide show
  1. models/hsd_tr.py +12 -10
models/hsd_tr.py CHANGED
@@ -10,15 +10,17 @@ label_dict = {'LABEL_0': 'Hate', 'LABEL_1': 'Non-hate'}
10
 
11
 
12
  #st.title("Hate Speech Detection in Turkish with HuggingFace Spaces")
13
- #st.write("Enter a Turkish sentence to detect its hateful:")
14
-
15
  #user_input = st.text_input(" ")
16
- #user_input = st.text_input("Enter your text here:",)
17
- if st.button("Predict"):
 
18
  #if user_input:
19
- result = sentiment_pipeline(user_input)
20
- sentiment = result[0]["label"]
21
- label_dict = {'LABEL_0': 'Hate', 'LABEL_1': 'Non-hate'}
22
- sentiment = label_dict[sentiment]
23
- #st.write(f"Detection: {sentiment}")
24
- #st.success(sentiment)
 
 
 
10
 
11
 
12
  #st.title("Hate Speech Detection in Turkish with HuggingFace Spaces")
13
+ #st.write("Enter a Turkish sentence here:")
 
14
  #user_input = st.text_input(" ")
15
+
16
+ user_input = st.text_input("Enter your text here:",)
17
+
18
  #if user_input:
19
+ if st.button("Click for predictions!"):
20
+ with st.spinner('Generating predictions...'):
21
+ result = sentiment_pipeline(user_input)
22
+ sentiment = result[0]["label"]
23
+ label_dict = {'LABEL_0': 'Hate', 'LABEL_1': 'Non-hate'}
24
+ sentiment = label_dict[sentiment]
25
+ #st.write(f"Detection: {sentiment}")
26
+ #st.success(sentiment)