Add link to code
#1
by
nielsr
HF staff
- opened
README.md
CHANGED
@@ -69,7 +69,7 @@ category_names = [
|
|
69 |
prob_vector = probabilities[0].tolist() # shape: (12,)
|
70 |
|
71 |
predicted_labels = []
|
72 |
-
for cat_name, prob in zip(category_names, prob_vector):
|
73 |
label = 1 if prob > threshold else 0
|
74 |
predicted_labels.append(label)
|
75 |
|
@@ -88,6 +88,8 @@ print(f"\nMaximum probability across all categories: {max_prob:.3f}")
|
|
88 |
print(f"Overall Prompt Classification => {'UNSAFE' if overall_label == 1 else 'SAFE'}")
|
89 |
```
|
90 |
|
|
|
|
|
91 |
### Citation
|
92 |
|
93 |
```plaintext
|
|
|
69 |
prob_vector = probabilities[0].tolist() # shape: (12,)
|
70 |
|
71 |
predicted_labels = []
|
72 |
+
for cat_name, prob, label in zip(category_names, prob_vector):
|
73 |
label = 1 if prob > threshold else 0
|
74 |
predicted_labels.append(label)
|
75 |
|
|
|
88 |
print(f"Overall Prompt Classification => {'UNSAFE' if overall_label == 1 else 'SAFE'}")
|
89 |
```
|
90 |
|
91 |
+
You can find the code at https://github.com/yihedeng9/DuoGuard.
|
92 |
+
|
93 |
### Citation
|
94 |
|
95 |
```plaintext
|