team_nlp_project / pages /1toxic_messages.py
romnatall
deploy
26290c2
raw
history blame contribute delete
519 Bytes
import re
import streamlit as st
import torch
from pages.anti_toxic.anti_toxic import *
st.title("toxic filtrer")
input_text = st.text_area("Enter your text")
dec = {0:'нормальный',1:'токсик'}
if input_text:
with torch.no_grad():
ans = predict(input_text).tolist()
if ans[1] > 0.5:
st.write(f'{dec[1]}, уверенность {round(ans[1],2)}')
else:
st.write(f'{dec[0]}, уверенность {round(ans[0],2)}')
else:
st.write("No text entered")