Spaces:
Build error
Build error
Set input max sequence length
Browse files
app.py
CHANGED
|
@@ -11,7 +11,7 @@ pipe = pipeline("text-classification", model=model_ckpt)
|
|
| 11 |
|
| 12 |
def predict(text: str) -> dict:
|
| 13 |
"""Compute predictions for text."""
|
| 14 |
-
preds = pipe(text, return_all_scores=True)
|
| 15 |
if preds:
|
| 16 |
pred = preds[0]
|
| 17 |
return {p["label"]: float(p["score"]) for p in pred}
|
|
|
|
| 11 |
|
| 12 |
def predict(text: str) -> dict:
|
| 13 |
"""Compute predictions for text."""
|
| 14 |
+
preds = pipe(text, return_all_scores=True, truncation=True, max_length=128)
|
| 15 |
if preds:
|
| 16 |
pred = preds[0]
|
| 17 |
return {p["label"]: float(p["score"]) for p in pred}
|