msamogh commited on
Commit
e15feb1
1 Parent(s): 5145a5a

Prettify OOS prediction

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -34,8 +34,9 @@ def predict(model_type, input):
34
 
35
  def oos_predict(input):
36
  inputs = tokenizer(input, return_tensors="pt")
37
- outputs = model(**inputs)
38
- return str(outputs)
 
39
 
40
 
41
  def rasa_predict(input):
 
34
 
35
  def oos_predict(input):
36
  inputs = tokenizer(input, return_tensors="pt")
37
+ outputs = model(**inputs).logits
38
+ outputs = torch.softmax(torch.tensor(outputs), dim=-1)[0]
39
+ return str({"In scope": outputs[1], "Out of scope": outputs[0]})
40
 
41
 
42
  def rasa_predict(input):