rbughao commited on
Commit
56dde06
1 Parent(s): 98d6a04

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -44,9 +44,11 @@ def analyze_output(vtext: str):
44
  pipe = pipeline("text-classification", model="Titeiiko/OTIS-Official-Spam-Model")
45
  x = pipe(vtext)[0]
46
  if x["label"] == "LABEL_0":
47
- spammy = {"type":"Not Spam", "probability":x["score"]}
 
48
  else:
49
- spammy = {"type":"Spam", "probability":x["score"]}
 
50
 
51
  return "spammy"
52
  ### Spammy or not
@@ -62,8 +64,7 @@ def measure_readability(message,history):
62
  text = re.sub(CLEANR,'', cleantext)
63
  else:
64
  text = message
65
-
66
- vtext = text
67
  vline1 = "==== Content Info ==== " + os.linesep
68
  vline2 = "Character Count "+str(textstat.char_count(text, ignore_spaces=True)) + os.linesep
69
  vline3 = "Lexicon Count "+str(textstat.lexicon_count(text, removepunct=True)) + os.linesep
@@ -85,11 +86,11 @@ def measure_readability(message,history):
85
  pipe = pipeline("text-classification", model="Titeiiko/OTIS-Official-Spam-Model")
86
  x = pipe(text)[0]
87
  if x["label"] == "LABEL_0":
88
- spammy = {"type":"Not Spam", "probability":x["score"]}
 
89
  else:
90
- spammy = {"type":"Spam", "probability":x["score"]}
91
-
92
- vspam = str(spammy)
93
 
94
  answer = vline1+vline2+vline3+vline4+vline5+vline6+vline7+vline8+vline9+vline10+vline11+vline12+vline14+spammy
95
  #answer = "Flesch Reading Ease (90-100 = Easy to read, 0-29 = Very confusing to read) is "+str(textstat.flesch_reading_ease(text))
 
44
  pipe = pipeline("text-classification", model="Titeiiko/OTIS-Official-Spam-Model")
45
  x = pipe(vtext)[0]
46
  if x["label"] == "LABEL_0":
47
+ spammy = "Not Spammy"
48
+ #{"type":"Not Spam", "probability":x["score"]}
49
  else:
50
+ spammy = "Spammy"
51
+ #{"type":"Spam", "probability":x["score"]}
52
 
53
  return "spammy"
54
  ### Spammy or not
 
64
  text = re.sub(CLEANR,'', cleantext)
65
  else:
66
  text = message
67
+
 
68
  vline1 = "==== Content Info ==== " + os.linesep
69
  vline2 = "Character Count "+str(textstat.char_count(text, ignore_spaces=True)) + os.linesep
70
  vline3 = "Lexicon Count "+str(textstat.lexicon_count(text, removepunct=True)) + os.linesep
 
86
  pipe = pipeline("text-classification", model="Titeiiko/OTIS-Official-Spam-Model")
87
  x = pipe(text)[0]
88
  if x["label"] == "LABEL_0":
89
+ spammy = "Not Spammy"
90
+ #{"type":"Not Spam", "probability":x["score"]}
91
  else:
92
+ spammy = "Spammy"
93
+ #{"type":"Spam", "probability":x["score"]}
 
94
 
95
  answer = vline1+vline2+vline3+vline4+vline5+vline6+vline7+vline8+vline9+vline10+vline11+vline12+vline14+spammy
96
  #answer = "Flesch Reading Ease (90-100 = Easy to read, 0-29 = Very confusing to read) is "+str(textstat.flesch_reading_ease(text))