Spaces:
Runtime error
Runtime error
johnpaulbin
commited on
Commit
•
825a6ae
1
Parent(s):
3e42d5f
Update app.py
Browse files
app.py
CHANGED
@@ -96,7 +96,7 @@ model = nn.Sequential(
|
|
96 |
nn.Dropout(0.05) # Dropout
|
97 |
)
|
98 |
|
99 |
-
model.load_state_dict(torch.load("large.pth", map_location=torch.device('cpu')))
|
100 |
model.eval()
|
101 |
|
102 |
|
@@ -107,7 +107,7 @@ def inf(inpt):
|
|
107 |
embedding = sentencemodel.encode(TEXT, convert_to_tensor=True)
|
108 |
INPUT = torch.cat((probs, embedding))
|
109 |
output = F.softmax(model(INPUT.view(1, -1)), dim=1)
|
110 |
-
if not output[0][1] > 0.
|
111 |
return "Not toxic " + str(output[0][0])
|
112 |
else:
|
113 |
return "Toxic! " + str(output[0][1])
|
|
|
96 |
nn.Dropout(0.05) # Dropout
|
97 |
)
|
98 |
|
99 |
+
model.load_state_dict(torch.load("large-tuned.pth", map_location=torch.device('cpu')))
|
100 |
model.eval()
|
101 |
|
102 |
|
|
|
107 |
embedding = sentencemodel.encode(TEXT, convert_to_tensor=True)
|
108 |
INPUT = torch.cat((probs, embedding))
|
109 |
output = F.softmax(model(INPUT.view(1, -1)), dim=1)
|
110 |
+
if not output[0][1] > 0.4:
|
111 |
return "Not toxic " + str(output[0][0])
|
112 |
else:
|
113 |
return "Toxic! " + str(output[0][1])
|