papluca commited on
Commit
4dcc920
1 Parent(s): 6971908

Set input max sequence length

Browse files
Files changed (1) hide show
  1. app.py +1 -1
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}