johnpaulbin commited on
Commit
58627d4
1 Parent(s): c476cdf

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from setfit import SetFitModel
3
+
4
+
5
+ model = SetFitModel.from_pretrained("johnpaulbin/beanbox-toxic")
6
+
7
+ def inf(inpt):
8
+ out = model.predict_proba([inpt])
9
+
10
+ if out[0][0] > out[0][1]:
11
+ return "Not toxic"
12
+ else:
13
+ return "Toxic!"
14
+
15
+ iface = gr.Interface(fn=inf, inputs="text", outputs="text")
16
+ iface.launch()