Update test.py
Browse files
test.py
CHANGED
|
@@ -59,13 +59,3 @@ def predict(model, embeddings):
|
|
| 59 |
|
| 60 |
return {"category_scores": result, 'detect': detected, 'detected': detect_value}
|
| 61 |
|
| 62 |
-
|
| 63 |
-
print('Load model')
|
| 64 |
-
moderation = ModerationModel()
|
| 65 |
-
moderation.load_state_dict(torch.load('moderation_model.pth'))
|
| 66 |
-
|
| 67 |
-
text = "I want to kill them."
|
| 68 |
-
|
| 69 |
-
embeddings_for_prediction = getEmb(text)
|
| 70 |
-
prediction = predict(moderation, embeddings_for_prediction)
|
| 71 |
-
print(json.dumps(prediction,indent=4))
|
|
|
|
| 59 |
|
| 60 |
return {"category_scores": result, 'detect': detected, 'detected': detect_value}
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|