Spaces:
Sleeping
Sleeping
File size: 752 Bytes
40302e7 46f8a81 f66e43c 40302e7 f9db5d8 48a493e f9db5d8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import nltk
nltk.download('averaged_perceptron_tagger')
import gradio as gr
import predictor
def check_string(string_to_predict):
try:
is_extremist = predictor.predictor().predict(string_to_predict)
if is_extremist:
return "The message has been identified as potentially containing violent far-right extremist content."
else:
return "The message has been identified as not containing violent far-right extremist content."
except FileNotFoundError as e:
return "The message was not feature rich enough to identify, try something else."
demo = gr.Interface(
fn=check_string,
inputs=gr.Textbox(lines=2, placeholder="Text to predict here..."),
outputs="text",
)
demo.launch() |