asofter commited on
Commit
aaf32c1
β€’
1 Parent(s): 26d9a8d

* add fmops model

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +8 -0
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: πŸ“
4
  colorFrom: yellow
5
  colorTo: gray
6
  sdk: gradio
7
- sdk_version: 4.7.0
8
  pinned: true
9
  license: apache-2.0
10
  ---
 
4
  colorFrom: yellow
5
  colorTo: gray
6
  sdk: gradio
7
+ sdk_version: 4.7.1
8
  pinned: true
9
  license: apache-2.0
10
  ---
app.py CHANGED
@@ -60,6 +60,9 @@ deepset_classifier = init_prompt_injection_model(
60
  "laiyer/deberta-v3-base-injection-onnx"
61
  ) # ONNX version of deepset/deberta-v3-base-injection
62
  laiyer_classifier = init_prompt_injection_model("laiyer/deberta-v3-base-prompt-injection", "onnx")
 
 
 
63
 
64
 
65
  def detect_hf(prompt: str, threshold: float = 0.5, classifier=laiyer_classifier) -> (bool, bool):
@@ -88,6 +91,10 @@ def detect_hf_deepset(prompt: str) -> (bool, bool):
88
  return detect_hf(prompt, classifier=deepset_classifier)
89
 
90
 
 
 
 
 
91
  def detect_lakera(prompt: str) -> (bool, bool):
92
  try:
93
  response = requests.post(
@@ -130,6 +137,7 @@ def detect_rebuff(prompt: str) -> (bool, bool):
130
  detection_providers = {
131
  "Laiyer (HF model)": detect_hf_laiyer,
132
  "Deepset (HF model)": detect_hf_deepset,
 
133
  "Lakera Guard": detect_lakera,
134
  "Automorphic Aegis": detect_automorphic,
135
  "Rebuff": detect_rebuff,
 
60
  "laiyer/deberta-v3-base-injection-onnx"
61
  ) # ONNX version of deepset/deberta-v3-base-injection
62
  laiyer_classifier = init_prompt_injection_model("laiyer/deberta-v3-base-prompt-injection", "onnx")
63
+ fmops_classifier = init_prompt_injection_model(
64
+ "laiyer/fmops-distilbert-prompt-injection-onnx"
65
+ ) # ONNX version of fmops/distilbert-prompt-injection
66
 
67
 
68
  def detect_hf(prompt: str, threshold: float = 0.5, classifier=laiyer_classifier) -> (bool, bool):
 
91
  return detect_hf(prompt, classifier=deepset_classifier)
92
 
93
 
94
+ def detect_hf_fmops(prompt: str) -> (bool, bool):
95
+ return detect_hf(prompt, classifier=fmops_classifier)
96
+
97
+
98
  def detect_lakera(prompt: str) -> (bool, bool):
99
  try:
100
  response = requests.post(
 
137
  detection_providers = {
138
  "Laiyer (HF model)": detect_hf_laiyer,
139
  "Deepset (HF model)": detect_hf_deepset,
140
+ "FMOps (HF model)": detect_hf_fmops,
141
  "Lakera Guard": detect_lakera,
142
  "Automorphic Aegis": detect_automorphic,
143
  "Rebuff": detect_rebuff,