Spaces:
Runtime error
Runtime error
arogeriogel
commited on
Commit
•
7a6e25f
1
Parent(s):
52a3606
update app
Browse files
app.py
CHANGED
@@ -105,28 +105,28 @@ def analyze_text():
|
|
105 |
if is_toxic:
|
106 |
st.session_state.text_error = "Your text entry was detected as toxic, please re-write it."
|
107 |
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
-
|
110 |
-
|
111 |
-
logging.info(f"This is the text being analysed: {st.session_state.text}")
|
112 |
-
st.session_state.text_error = ""
|
113 |
-
st.session_state.n_requests += 1
|
114 |
-
analyze(
|
115 |
-
text=st.session_state.text,
|
116 |
-
entities=st_entities,
|
117 |
-
language="en",
|
118 |
-
return_decision_process=False,
|
119 |
-
)
|
120 |
-
|
121 |
-
if st.session_state.excluded_words:
|
122 |
-
include_manual_input()
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
|
131 |
|
132 |
def include_manual_input():
|
|
|
105 |
if is_toxic:
|
106 |
st.session_state.text_error = "Your text entry was detected as toxic, please re-write it."
|
107 |
return
|
108 |
+
else:
|
109 |
+
with text_spinner_placeholder:
|
110 |
+
with st.spinner("Please wait while your text is being analysed..."):
|
111 |
+
logging.info(f"This is the text being analysed: {st.session_state.text}")
|
112 |
+
st.session_state.text_error = ""
|
113 |
+
st.session_state.n_requests += 1
|
114 |
+
analyze(
|
115 |
+
text=st.session_state.text,
|
116 |
+
entities=st_entities,
|
117 |
+
language="en",
|
118 |
+
return_decision_process=False,
|
119 |
+
)
|
120 |
|
121 |
+
if st.session_state.excluded_words:
|
122 |
+
include_manual_input()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
+
if st.session_state.allowed_words:
|
125 |
+
exclude_manual_input()
|
126 |
+
|
127 |
+
logging.info(
|
128 |
+
f"analyse results: {st.session_state.analyze_results}\n"
|
129 |
+
)
|
130 |
|
131 |
|
132 |
def include_manual_input():
|