Spaces:
Runtime error
Runtime error
zhangxiaochen
commited on
Commit
•
e9b8265
1
Parent(s):
dc772a7
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 |
|