FeddlZddlmZmZejredejdZnUejj	redejdZnedejdZd	Z
eje
Zeje
d

eZdZdS)
N)RobertaTokenizer RobertaForSequenceClassificationz
USING CUDAcudazUSING Apple Metalmpsz	USING CPUcpuzmshenoda/roberta-spam)
num_labelsc
t|dddd}d|D}tj5t	d	i|}dddn#1swxYwYtj|jdS)
Npt
max_lengthTi)return_tensorspadding
truncationrcJi|] \}}||t!S)todevice).0kvs   0/Users/kobaltz/Projects/spam-checker/detector.py
<dictcomp>zdetect.<locals>.<dictcomp>s(666!AqttF||666)dimr)	tokenizeritemstorchno_gradmodelargmaxlogits)textinputsoutputss   rdetectr&sT$QUbefff&66v||~~666&}oofooG
gn!	,	,	,,s
AA#&A#)rtransformersrrris_availableprintrbackendsr
model_pathfrom_pretrainedrrr r&rrr<module>r-sKKKKKKKK:%5<&&
^$$&&%5<&&%5<&
$
,,Z88	8(8PQRRRUUV\]]-----r