Spaces:
Runtime error
Runtime error
zhangxiaochen
commited on
fix typo
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ tokenizer=BertTokenizer.from_pretrained('IDEA-CCNL/Erlangshen-Roberta-330M-Senti
|
|
7 |
model=BertForSequenceClassification.from_pretrained('IDEA-CCNL/Erlangshen-Roberta-330M-Sentiment')
|
8 |
|
9 |
def predict(input_text):
|
10 |
-
predictions = model(torch.tensor([tokenizer.encode(
|
11 |
predictions=torch.nn.functional.softmax(predictions.logits,dim=-1)
|
12 |
return input_text, {p["label"]: p["score"] for p in predictions}
|
13 |
|
|
|
7 |
model=BertForSequenceClassification.from_pretrained('IDEA-CCNL/Erlangshen-Roberta-330M-Sentiment')
|
8 |
|
9 |
def predict(input_text):
|
10 |
+
predictions = model(torch.tensor([tokenizer.encode(input_text)]))
|
11 |
predictions=torch.nn.functional.softmax(predictions.logits,dim=-1)
|
12 |
return input_text, {p["label"]: p["score"] for p in predictions}
|
13 |
|