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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -3,11 +3,11 @@ 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,
 
3
 
4
  def analyze_output(input_text):
5
  pipe = pipeline("text-classification", model="Titeiiko/OTIS-Official-Spam-Model")
6
+ result = pipe(input_text)[0]
7
+ if result["label"] == "LABEL_0":
8
+ return f"Not Spam: {result['score']:.4f}"
9
  else:
10
+ return f"Spam: {result['score']:.4f}"
11
 
12
  iface = gr.Interface(
13
  fn=analyze_output,