import streamlit as st import requests API_URL = "https://api-inference.huggingface.co/models/cointegrated/rubert-tiny-toxicity" headers = {"Authorization": f"Bearer {'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'}"} def query(payload): response = requests.post(API_URL, headers=headers, json=payload) return response.json() text = st.text_input("Введите комментарий") if text: output = query(text)[0][0].get('label') if output == 'dangerous': st.markdown('

ОПАСНЫЙ КОММЕНТАРИЙ

', unsafe_allow_html=True) elif output == 'non-toxic': st.markdown('

Нормальный комментарий

', unsafe_allow_html=True) elif output == 'insult': st.markdown('

Оскорбительный комментарий

', unsafe_allow_html=True) elif output == 'threat': st.markdown('

Угрожающий комментарий

', unsafe_allow_html=True) elif output == 'obscenity': st.markdown('

ууу, непристойности

', unsafe_allow_html=True)