you can use np.round() function.
def accuracy(gt_S,pred_S):       
    gt_S  =np.asarray(gt_S) 
    pred_S=np.round(pred_S)      #will round to the nearest even number
    acc =  accuracy_score(gt_S,pred_S)
    f1m = f1_score(gt_S,pred_S,average = 'macro', zero_division=1)
    f1mi = f1_score(gt_S,pred_S,average = 'micro', zero_division=1)
    print('f1_Macro_Score{}'.format(f1m))
    print('f1_Micro_Score{}'.format(f1mi))
    print('Accuracy{}'.format(acc))