Spaces:
Runtime error
Runtime error
fix in app.py
Browse files
app.py
CHANGED
@@ -11,7 +11,7 @@ def translate(text):
|
|
11 |
input = tokenizer(text, return_tensors="pt")
|
12 |
labels = torch.tensor([1]).unsqueeze(0) # Batch size 1
|
13 |
output = model(**input, labels=labels)
|
14 |
-
logits =
|
15 |
prediction = F.softmax(logits, dim=1)
|
16 |
y_pred = torch.argmax(prediction).numpy()
|
17 |
return y_pred
|
|
|
11 |
input = tokenizer(text, return_tensors="pt")
|
12 |
labels = torch.tensor([1]).unsqueeze(0) # Batch size 1
|
13 |
output = model(**input, labels=labels)
|
14 |
+
logits = output.logits
|
15 |
prediction = F.softmax(logits, dim=1)
|
16 |
y_pred = torch.argmax(prediction).numpy()
|
17 |
return y_pred
|