SoDehghan's picture
Update models/hsd_tr.py
0bc5053 verified
raw
history blame
686 Bytes
import awesome_streamlit as ast
import streamlit as st
import requests
import time
from transformers import pipeline
import os
sentiment_pipeline = pipeline(task = "text-classification", model = "gritli/bert-sentiment-analyses-imdb")
label_dict = {'LABEL_0': 'Hate', 'LABEL_1': 'Non-hate'}
#st.title("Hate Speech Detection in Turkish with HuggingFace Spaces")
#st.write("Enter a Turkish sentence to detect its hateful:")
#user_input = st.text_input(" ")
user_input = st.text_input("Enter your text here:",)
if user_input:
result = sentiment_pipeline(user_input)
sentiment = result[0]["label"]
sentiment = label_dict[sentiment]
#st.write(f"Detection: {sentiment}")