* upgrade libraries
Browse files* use matching strategies for deanonymizer
- output.py +16 -0
- requirements.txt +4 -4
output.py
CHANGED
@@ -6,6 +6,7 @@ from typing import Dict, List
|
|
6 |
import streamlit as st
|
7 |
from llm_guard.input_scanners.anonymize import default_entity_types
|
8 |
from llm_guard.output_scanners import get_scanner_by_name
|
|
|
9 |
from llm_guard.output_scanners.relevance import all_models as relevance_models
|
10 |
from llm_guard.vault import Vault
|
11 |
from streamlit_tags import st_tags
|
@@ -137,6 +138,21 @@ def init_settings() -> (List, Dict):
|
|
137 |
|
138 |
settings["Code"] = {"allowed": allowed_languages, "denied": denied_languages}
|
139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
if "JSON" in st_enabled_scanners:
|
141 |
st_json_expander = st.sidebar.expander(
|
142 |
"JSON",
|
|
|
6 |
import streamlit as st
|
7 |
from llm_guard.input_scanners.anonymize import default_entity_types
|
8 |
from llm_guard.output_scanners import get_scanner_by_name
|
9 |
+
from llm_guard.output_scanners.deanonymize import MatchingStrategy as DeanonymizeMatchingStrategy
|
10 |
from llm_guard.output_scanners.relevance import all_models as relevance_models
|
11 |
from llm_guard.vault import Vault
|
12 |
from streamlit_tags import st_tags
|
|
|
138 |
|
139 |
settings["Code"] = {"allowed": allowed_languages, "denied": denied_languages}
|
140 |
|
141 |
+
if "Deanonymize" in st_enabled_scanners:
|
142 |
+
st_de_expander = st.sidebar.expander(
|
143 |
+
"Deanonymize",
|
144 |
+
expanded=False,
|
145 |
+
)
|
146 |
+
|
147 |
+
with st_de_expander:
|
148 |
+
st_de_matching_strategy = st.selectbox(
|
149 |
+
"Matching strategy", [e.value for e in DeanonymizeMatchingStrategy], index=0
|
150 |
+
)
|
151 |
+
|
152 |
+
settings["Deanonymize"] = {
|
153 |
+
"matching_strategy": DeanonymizeMatchingStrategy(st_de_matching_strategy)
|
154 |
+
}
|
155 |
+
|
156 |
if "JSON" in st_enabled_scanners:
|
157 |
st_json_expander = st.sidebar.expander(
|
158 |
"JSON",
|
requirements.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
llm-guard==0.3.
|
2 |
-
llm-guard[onnxruntime]==0.3.
|
3 |
-
pandas==2.1.
|
4 |
-
streamlit==1.
|
5 |
streamlit-tags==1.2.8
|
|
|
1 |
+
llm-guard==0.3.4
|
2 |
+
llm-guard[onnxruntime]==0.3.4
|
3 |
+
pandas==2.1.4
|
4 |
+
streamlit==1.29.0
|
5 |
streamlit-tags==1.2.8
|