Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,11 @@
|
|
1 |
-
import
|
2 |
-
from gradio.mix import Series
|
3 |
|
4 |
-
|
5 |
-
|
|
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
translator_en = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-en-es")
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
interface = Series(translator_es, story_gen, translator_en, description = description,
|
14 |
-
title = title,
|
15 |
-
examples=examples,
|
16 |
-
inputs = gr.inputs.Textbox(lines = 10)
|
17 |
-
)
|
18 |
-
|
19 |
-
interface.launch()
|
|
|
1 |
+
from transformers import RobertaTokenizer, RobertaForSequenceClassification
|
|
|
2 |
|
3 |
+
# load tokenizer and model weights
|
4 |
+
tokenizer = RobertaTokenizer.from_pretrained('SkolkovoInstitute/roberta_toxicity_classifier')
|
5 |
+
model = RobertaForSequenceClassification.from_pretrained('SkolkovoInstitute/roberta_toxicity_classifier')
|
6 |
|
7 |
+
# prepare the input
|
8 |
+
batch = tokenizer.encode('you are amazing', return_tensors='pt')
|
|
|
9 |
|
10 |
+
# inference
|
11 |
+
model(batch)
|
|
|
|
|
|
|
|
|
|
|
|
|
|