Prettify OOS prediction
Browse files
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 |
-
|
|
|
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):
|