Spaces:
Sleeping
Sleeping
Download app.py from fasherr/toxicity-rubert: direct link, hf CLI and curl.
- Browser
- Download file 545 Bytes
-
https://huggingface.co/spaces/fasherr/toxicity-rubert/resolve/main/app.py
- Command line
-
hf download hf://spaces/fasherr/toxicity-rubert/app.py
-
curl -L -o app.py https://huggingface.co/spaces/fasherr/toxicity-rubert/resolve/main/app.py
545 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| model = "fasherr/toxicity_rubert" | |
| pipe = pipeline("text-classification", model=model) | |
| def predict(text): | |
| res = pipe(text) | |
| return f"{res[0]['label']} - {res[0]['score']:.2%}" | |
| site = gr.Interface( | |
| fn=predict, | |
| inputs=gr.Textbox(placeholder="Введите текст"), | |
| outputs="text", | |
| title="Классификатор токсичности", | |
| description="Определение токсичноти текста на русском языке" | |
| ) | |
| site.launch() |