User1342 commited on
Commit
3562beb
1 Parent(s): 84aae4b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -3
app.py CHANGED
@@ -1,8 +1,22 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
 
 
 
 
 
 
 
 
 
 
 
 
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()