rbughao commited on
Commit
81a8113
verified
1 Parent(s): edeb7cc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -1,16 +1,13 @@
1
- import gradio as gr
2
- from transformers import pipeline, AutoModelForTokenClassification, AutoTokenizer
3
 
4
 
5
- def analyze_output(input):
6
- pipe = pipeline("text-classification", model='Titeiiko/OTIS-Official-Spam-Model')
7
- return "hello"
8
  x = pipe(input)[0]
9
  if x["label"] == "LABEL_0":
10
  return {"type":"Not Spam", "probability":x["score"]}
11
  else:
12
  return {"type":"Spam", "probability":x["score"]}
 
13
 
14
-
15
- demo = gr.Interface(fn=analyze_output, inputs="text", outputs="text")
16
- demo.launch()
 
1
+ from transformers import pipeline
 
2
 
3
 
4
+ def analyze_output(input: str):
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
 
13
+ print(analyze_output("C一eck out our amazin伞 b芯芯褧ting servi褋e 选here you can get to Leve訌 3 for 3 mont一s for just 20 USD."))