Update main.py
Browse files
main.py
CHANGED
|
@@ -173,7 +173,7 @@ class Guard :
|
|
| 173 |
print('-'*100)
|
| 174 |
print(f'THE SCORE ATTACK WITH BAYES IS {score} and the SCORES WITH LOGIT ATT:{score2} DEF:{score3} ')
|
| 175 |
print('-'*100)
|
| 176 |
-
|
| 177 |
f= 0.5*score + 0.5*score2
|
| 178 |
if score3>f and score3>0.9:
|
| 179 |
prompt_info['is_safe'] = True
|
|
@@ -181,7 +181,7 @@ class Guard :
|
|
| 181 |
prompt_info['confidence_score'] = 100*round(score3, 4)
|
| 182 |
prompt_info['latency'] = round(time.time() - start_time , 4)
|
| 183 |
return prompt_info
|
| 184 |
-
elif score3 <0.5:
|
| 185 |
prompt_info['is_safe'] = False
|
| 186 |
prompt_info['decision'] = 'BLOCKED'
|
| 187 |
prompt_info['confidence_score'] = 100
|
|
|
|
| 173 |
print('-'*100)
|
| 174 |
print(f'THE SCORE ATTACK WITH BAYES IS {score} and the SCORES WITH LOGIT ATT:{score2} DEF:{score3} ')
|
| 175 |
print('-'*100)
|
| 176 |
+
|
| 177 |
f= 0.5*score + 0.5*score2
|
| 178 |
if score3>f and score3>0.9:
|
| 179 |
prompt_info['is_safe'] = True
|
|
|
|
| 181 |
prompt_info['confidence_score'] = 100*round(score3, 4)
|
| 182 |
prompt_info['latency'] = round(time.time() - start_time , 4)
|
| 183 |
return prompt_info
|
| 184 |
+
elif score3 <0.5 and score2 >0.4:
|
| 185 |
prompt_info['is_safe'] = False
|
| 186 |
prompt_info['decision'] = 'BLOCKED'
|
| 187 |
prompt_info['confidence_score'] = 100
|