Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -112,7 +112,6 @@ st_text = st.text_area(
|
|
| 112 |
"like a phone number (212-141-4544) "
|
| 113 |
"or a name (Lebron James).",
|
| 114 |
height=200,
|
| 115 |
-
# label_visibility="collapsed",
|
| 116 |
)
|
| 117 |
|
| 118 |
# After
|
|
@@ -128,6 +127,7 @@ with st.spinner("Analyzing..."):
|
|
| 128 |
annotated_tokens = annotate(st_text, st_analyze_results, st_entities)
|
| 129 |
# annotated_tokens
|
| 130 |
annotated_text(*annotated_tokens)
|
|
|
|
| 131 |
st.text("")
|
| 132 |
|
| 133 |
st.subheader("Anonymized")
|
|
@@ -138,10 +138,13 @@ with st.spinner("Anonymizing..."):
|
|
| 138 |
|
| 139 |
|
| 140 |
# table result
|
| 141 |
-
st.subheader("Findings")
|
| 142 |
if st_analyze_results:
|
| 143 |
-
|
| 144 |
-
|
|
|
|
|
|
|
|
|
|
| 145 |
{
|
| 146 |
"entity_type": "Entity type",
|
| 147 |
"start": "Start",
|
|
|
|
| 112 |
"like a phone number (212-141-4544) "
|
| 113 |
"or a name (Lebron James).",
|
| 114 |
height=200,
|
|
|
|
| 115 |
)
|
| 116 |
|
| 117 |
# After
|
|
|
|
| 127 |
annotated_tokens = annotate(st_text, st_analyze_results, st_entities)
|
| 128 |
# annotated_tokens
|
| 129 |
annotated_text(*annotated_tokens)
|
| 130 |
+
# vertical space
|
| 131 |
st.text("")
|
| 132 |
|
| 133 |
st.subheader("Anonymized")
|
|
|
|
| 138 |
|
| 139 |
|
| 140 |
# table result
|
| 141 |
+
st.subheader("Detailed Findings")
|
| 142 |
if st_analyze_results:
|
| 143 |
+
res_dicts = [r.to_dict() for r in st_analyze_results]
|
| 144 |
+
for d in res_dicts:
|
| 145 |
+
d['Value'] = st_text[d['start']:d['end']]
|
| 146 |
+
df = pd.DataFrame.from_records(res_dicts)
|
| 147 |
+
df = df[["entity_type", "Value", "score", "start", "end"]].rename(
|
| 148 |
{
|
| 149 |
"entity_type": "Entity type",
|
| 150 |
"start": "Start",
|