sdafd commited on
Commit
92f34f9
1 Parent(s): e6281e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -2,9 +2,13 @@ import gradio as gr
2
  from transformers import pipeline
3
 
4
  def analyze_output(input_text):
5
- pipe = pipeline("text-classification", model="ZachBeesley/Spam-Detector")
6
- result = pipe(input_text)[0]
7
- return str(result)
 
 
 
 
8
  iface = gr.Interface(
9
  fn=analyze_output,
10
  inputs=gr.Textbox(),
 
2
  from transformers import pipeline
3
 
4
  def analyze_output(input_text):
5
+ pipe = pipeline("text-classification", model="Titeiiko/OTIS-Official-Spam-Model")
6
+ x = pipe(input)[0]
7
+ if x["label"] == "LABEL_0":
8
+ return {"type":"Not Spam", "probability":x["score"]}
9
+ else:
10
+ return {"type":"Spam", "probability":x["score"]}
11
+
12
  iface = gr.Interface(
13
  fn=analyze_output,
14
  inputs=gr.Textbox(),