SoDehghan commited on
Commit
8e85438
β€’
1 Parent(s): c214c3f

Rename app.py to ap.py

Browse files
Files changed (1) hide show
  1. app.py β†’ ap.py +5 -3
app.py β†’ ap.py RENAMED
@@ -26,16 +26,17 @@ st.subheader(header_tr)
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
 
34
  strength_tr = " "
35
  st.write(f"Detection: {sentiment_tr}, Strength: {strength_tr}")
36
 
37
 
38
- st.write(' ')
39
  # Arabic
40
  sentiment_pipeline_ar = pipeline(task = "text-classification", model = "SoDehghan/BERTurk-hate-speech")
41
  header_ar = r"$\textsf{\scriptsize HSD in Arabic}$"
@@ -44,9 +45,10 @@ st.subheader(header_ar)
44
  ar_input = st.text_area("Enter your text here:", height=50 , key="ar_input")
45
  if st.button("Click for predictions!", key="ar_predict"):
46
  with st.spinner('Generating predictions...'):
 
47
  result_ar = sentiment_pipeline_ar(ar_input)
48
  sentiment_ar = result_ar[0]["label"]
49
- label_dict = {'LABEL_1': 'Hate ❌ ', 'LABEL_0': 'Non-hate βœ… '}
50
  sentiment_ar = label_dict[sentiment_ar]
51
 
52
  strength_tr = " "
 
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
+ st.write(" ")
30
  result_tr = sentiment_pipeline_tr(tr_input)
31
  sentiment_tr = result_tr[0]["label"]
32
+ label_dict = {'LABEL_1': 'Hate ❌ ', 'LABEL_0': 'Non-hate βœ… '} #🚫
33
  sentiment_tr = label_dict[sentiment_tr]
34
 
35
  strength_tr = " "
36
  st.write(f"Detection: {sentiment_tr}, Strength: {strength_tr}")
37
 
38
 
39
+ st.write(" ")
40
  # Arabic
41
  sentiment_pipeline_ar = pipeline(task = "text-classification", model = "SoDehghan/BERTurk-hate-speech")
42
  header_ar = r"$\textsf{\scriptsize HSD in Arabic}$"
 
45
  ar_input = st.text_area("Enter your text here:", height=50 , key="ar_input")
46
  if st.button("Click for predictions!", key="ar_predict"):
47
  with st.spinner('Generating predictions...'):
48
+ st.write(" ")
49
  result_ar = sentiment_pipeline_ar(ar_input)
50
  sentiment_ar = result_ar[0]["label"]
51
+ label_dict = {'LABEL_1': 'Hate ❌ ', 'LABEL_0': 'Non-hate βœ… '}
52
  sentiment_ar = label_dict[sentiment_ar]
53
 
54
  strength_tr = " "