Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,14 +51,12 @@ class RobertaClass(torch.nn.Module):
|
|
| 51 |
output = self.classifier(pooler)
|
| 52 |
return output
|
| 53 |
|
| 54 |
-
@st.cache
|
| 55 |
tokenizer = RobertaTokenizer.from_pretrained('roberta-base', truncation=True, do_lower_case=True,
|
| 56 |
vocab_file='model/vocab.json',
|
| 57 |
merges_file='model/merges.txt')
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
-
@st.cache
|
| 62 |
model = torch.load('model/pytorch_roberta_sentiment.bin', map_location=torch.device('cpu'))
|
| 63 |
|
| 64 |
|
|
@@ -140,9 +138,3 @@ if st.button("Посмотреть топ"):
|
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
-
from transformers import pipeline
|
| 144 |
-
# тут уже знакомый вам код с huggingface.transformers -- его можно заменить на что угодно от fairseq до catboost
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
# выводим результаты модели в текстовое поле, на потеху пользователю
|
|
|
|
| 51 |
output = self.classifier(pooler)
|
| 52 |
return output
|
| 53 |
|
|
|
|
| 54 |
tokenizer = RobertaTokenizer.from_pretrained('roberta-base', truncation=True, do_lower_case=True,
|
| 55 |
vocab_file='model/vocab.json',
|
| 56 |
merges_file='model/merges.txt')
|
| 57 |
|
| 58 |
|
| 59 |
|
|
|
|
| 60 |
model = torch.load('model/pytorch_roberta_sentiment.bin', map_location=torch.device('cpu'))
|
| 61 |
|
| 62 |
|
|
|
|
| 138 |
|
| 139 |
|
| 140 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|