File size: 727 Bytes
3c27def
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import argparse
from .classifier import ToxicTextClassifier

def getArgs():
    parser = argparse.ArgumentParser(description="LiteDetective - Malicious Content Detection Pipeline")
    parser.add_argument("--path", type=str, default="output/cold.pth", required=False, help="Path to the model")
    parser.add_argument("--device", type=str, default="cpu", required=False, help="Device to use (cpu, mps, or cuda)")
    parser.add_argument("args", nargs='+', help="the text to detect")

    args = parser.parse_args()
    return args

def main():
    args = getArgs()
    model = ToxicTextClassifier(path=args.path)
    result = model.predict(args.args, device=args.device)
    print(result)

if __name__ == "__main__":
    main()