Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,22 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
def
|
4 |
-
|
|
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
demo.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import predictor
|
3 |
|
4 |
+
def check_string(string_to_predict):
|
5 |
+
try:
|
6 |
+
is_extremist = predictor.predictor().predict(string_to_predict)
|
7 |
|
8 |
+
|
9 |
+
if is_extremist:
|
10 |
+
return "The message has been identified as potentially containing violent far-right extremist content."
|
11 |
+
else:
|
12 |
+
return "The message has been identified as not containing violent far-right extremist content."
|
13 |
+
except FileNotFoundError as e:
|
14 |
+
return "The message was not feature rich enough to identify, try something else. {}".format(e)
|
15 |
+
|
16 |
+
demo = gr.Interface(
|
17 |
+
fn=check_string,
|
18 |
+
inputs=gr.Textbox(lines=2, placeholder="Text to predict here..."),
|
19 |
+
outputs="text",
|
20 |
+
)
|
21 |
|
22 |
demo.launch()
|